text:
#include "paddle/fluid/platform/errors.h"

#include <string>

#include "gtest/gtest.h"
#include "paddle/fluid/platform/enforce.h"

using namespace paddle::platform::errors;  // NOLINT

#define CHECK_PADDLE_THROW(EFUNC)                                          \
  do {                                                                     \
    bool caught_exception = false;                                         \
    try {                                                                  \
      PADDLE_THROW((EFUNC)("paddle throw test."));                         \
    } catch (paddle::platform::EnforceNotMet & error) {                    \
      caught_exception = true;                                             \
      std::string ex_msg = error.what();                                   \
      EXPECT_TRUE(ex_msg.find("paddle throw test.") != std::string::npos); \
    }                                                                      \
    EXPECT_TRUE(caught_exception);                                         \
  } while (0)

#define CHECK_PADDLE_ENFORCE(EFUNC)                                          \
  do {                                                                       \
    bool caught_exception = false;                                           \
    try {                                                                    \
      PADDLE_ENFORCE(false, (EFUNC)("paddle enforce test."));                \
    } catch (paddle::platform::EnforceNotMet & error) {                      \
      caught_exception = true;                                               \
      std::string ex_msg = error.what();                                     \
      EXPECT_TRUE(ex_msg.find("paddle enforce test.") != std::string::npos); \
    }                                                                        \
    EXPECT_TRUE(caught_exception);                                           \
  } while (0)

#define CHECK_PADDLE_ENFORCE_NOT_NULL(EFUNC)                             \
  do {                                                                   \
    bool caught_exception = false;                                       \
    try {                                                                \
      PADDLE_ENFORCE_NOT_NULL(nullptr,                                   \
                              (EFUNC)("paddle enforce not null test.")); \
    } catch (paddle::platform::EnforceNotMet & error) {                  \
      caught_exception = true;                                           \
      std::string ex_msg = error.what();                                 \
      EXPECT_TRUE(ex_msg.find("paddle enforce not null test.") !=        \
                  std::string::npos);                                    \
    }                                                                    \
    EXPECT_TRUE(caught_exception);                                       \
  } while (0)

#define CHECK_PADDLE_ENFORCE_EQ(EFUNC)                                \
  do {                                                                \
    bool caught_exception = false;                                    \
    try {                                                             \
      PADDLE_ENFORCE_EQ(1, 2, (EFUNC)("paddle enforce equal test.")); \
    } catch (paddle::platform::EnforceNotMet & error) {               \
      caught_exception = true;                                        \
      std::string ex_msg = error.what();                              \
      EXPECT_TRUE(ex_msg.find("paddle enforce equal test.") !=        \
                  std::string::npos);                                 \
    }                                                                 \
    EXPECT_TRUE(caught_exception);                                    \
  } while (0)

#define CHECK_ALL_PADDLE_EXCEPTION_MACRO(EFUNC) \
  do {                                          \
    CHECK_PADDLE_THROW(EFUNC);                  \
    CHECK_PADDLE_ENFORCE(EFUNC);                \
    CHECK_PADDLE_ENFORCE_NOT_NULL(EFUNC);       \
    CHECK_PADDLE_ENFORCE_EQ(EFUNC);             \
  } while (0)

TEST(Errors, InvalidArgument) {
  CHECK_ALL_PADDLE_EXCEPTION_MACRO(InvalidArgument);
}

TEST(Errors, NotFound) { CHECK_ALL_PADDLE_EXCEPTION_MACRO(NotFound); }

TEST(Errors, OutOfRange) { CHECK_ALL_PADDLE_EXCEPTION_MACRO(OutOfRange); }

TEST(Errors, AlreadExists) { CHECK_ALL_PADDLE_EXCEPTION_MACRO(AlreadyExists); }

TEST(Errors, ResourceExhausted) {
  CHECK_ALL_PADDLE_EXCEPTION_MACRO(ResourceExhausted);
}

TEST(Errors, PreconditionNotMet) {
  CHECK_ALL_PADDLE_EXCEPTION_MACRO(PreconditionNotMet);
}

TEST(Errors, PermissionDenied) {
  CHECK_ALL_PADDLE_EXCEPTION_MACRO(PermissionDenied);
}

TEST(Errors, ExecutionTimeout) {
  CHECK_ALL_PADDLE_EXCEPTION_MACRO(ExecutionTimeout);
}

TEST(Errors, Unimplemented) { CHECK_ALL_PADDLE_EXCEPTION_MACRO(Unimplemented); }

TEST(Errors, Unavailable) { CHECK_ALL_PADDLE_EXCEPTION_MACRO(Unavailable); }

TEST(Errors, Fatal) { CHECK_ALL_PADDLE_EXCEPTION_MACRO(Fatal); }

TEST(Errors, External) { CHECK_ALL_PADDLE_EXCEPTION_MACRO(External); }


text:
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
import {StreamExportComponent} from './export.component';
import {FormsModule} from '@angular/forms';
import {ClarityModule} from '@clr/angular';
import {RouterTestingModule} from '@angular/router/testing';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {SecurityServiceMock} from '../../../tests/api/security.service.mock';
import {AboutServiceMock} from '../../../tests/api/about.service.mock';
import {StreamServiceMock} from '../../../tests/api/stream.service.mock';
import {TaskServiceMock} from '../../../tests/api/task.service.mock';
import {NotificationServiceMock} from '../../../tests/service/notification.service.mock';
import {ImportExportServiceMock} from '../../../tests/service/import-export.service.mock';
import {ContextServiceMock} from '../../../tests/service/context.service.mock';

describe('manage/tools/stream/export.component.ts', () => {
  let component: StreamExportComponent;
  let fixture: ComponentFixture<StreamExportComponent>;

  beforeEach(
    waitForAsync(() => {
      TestBed.configureTestingModule({
        declarations: [StreamExportComponent],
        imports: [FormsModule, ClarityModule, RouterTestingModule.withRoutes([]), BrowserAnimationsModule],
        providers: [
          SecurityServiceMock.provider,
          AboutServiceMock.provider,
          StreamServiceMock.provider,
          TaskServiceMock.provider,
          NotificationServiceMock.provider,
          ImportExportServiceMock.provider,
          ContextServiceMock.provider
        ]
      }).compileComponents();
    })
  );

  beforeEach(() => {
    fixture = TestBed.createComponent(StreamExportComponent);
    component = fixture.componentInstance;
    NotificationServiceMock.mock.clearAll();
  });

  it('should be created', () => {
    fixture.detectChanges();
    expect(component).toBeTruthy();
  });

  it('should run a stream export', async done => {
    fixture.detectChanges();
    component.open();
    setTimeout(() => {
      fixture.detectChanges();
      component.run();
      fixture.detectChanges();
      expect(NotificationServiceMock.mock.successNotifications[0].title).toBe('Stream(s) export');
      expect(NotificationServiceMock.mock.successNotifications[0].message).toBe('Stream(s) has been exported.');
      expect(component.isOpen).toBeFalsy();
      done();
    }, 200);
  });

  it('should manage error if no stream selected', async done => {
    fixture.detectChanges();
    component.open();
    setTimeout(() => {
      fixture.detectChanges();
      component.selected = [];
      component.run();
      fixture.detectChanges();
      expect(NotificationServiceMock.mock.errorNotification[0].title).toBe('No stream selected');
      expect(NotificationServiceMock.mock.errorNotification[0].message).toBe('Please, select stream(s) to export.');
      done();
    }, 200);
  });
});

redpajama_set_name: RedPajamaGithub


text:
package net.rushashki.social.shashki64.shared.model.entity;

import com.google.gwt.user.client.rpc.IsSerializable;
import net.rushashki.social.shashki64.shared.model.key.FriendId;

import javax.annotation.Nullable;
import javax.persistence.*;
import java.io.Serializable;

/**
 * Created with IntelliJ IDEA.
 * User: alekspo
 * Date: 01.12.14
 * Time: 14:10
 */
@Entity
@Table(name = "friend")
@AssociationOverrides({
    @AssociationOverride(name = "pk.friend", joinColumns = @JoinColumn(name = "friend_id", insertable = false, updatable = false)),
    @AssociationOverride(name = "pk.friendOf", joinColumns = @JoinColumn(name = "friend_of_id", insertable = false, updatable = false)) })
public class FriendEntity implements IsSerializable {

  @EmbeddedId
  private FriendId pk = new FriendId();
  @Nullable
  private boolean favorite;

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    FriendEntity friend = (FriendEntity) o;

    if (favorite != friend.favorite) return false;
    if (!pk.equals(friend.pk)) return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result = pk.hashCode();
    result = 31 * result + (favorite ? 1 : 0);
    return result;
  }

  public boolean isFavorite() {
    return favorite;
  }

  public void setFavorite(boolean favorite) {
    this.favorite = favorite;
  }

  public FriendId getPk() {
    return pk;
  }

  public void setPk(FriendId pk) {
    this.pk = pk;
  }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Kohana 3.2 Templating with Twitter Bootstrap <?php echo ( ! empty($title)) ? Html::chars(" - ".$title) : ''; ?></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

	<?php foreach ($styles as $file => $type) echo HTML::style($file, array('media' => $type)), "\n" ?>
    <?php foreach ($scripts as $file) echo HTML::script($file), "\n" ?>

    <link rel="shortcut icon" href="assets/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png">

          Jefri

Home

About

Contact

      <?php echo $content ?>


text:
import React from 'react';

class NavBar extends React.Component {
	render() {
		return (

          Calculator

Vikram Jadhav

		);
	}
}

export default NavBar;


text:
package hllthrift

import (
	"bytes"
	"fmt"
	"git.apache.org/thrift.git/lib/go/thrift"
)

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

var GoUnusedProtection__ int

type Status int64

const (
	Status_SUCCESS        Status = 0
	Status_FAILURE        Status = 1
	Status_KEY_EXISTS     Status = 2
	Status_KEY_NOT_EXISTS Status = 3
)

func (p Status) String() string {
	switch p {
	case Status_SUCCESS:
		return "SUCCESS"
	case Status_FAILURE:
		return "FAILURE"
	case Status_KEY_EXISTS:
		return "KEY_EXISTS"
	case Status_KEY_NOT_EXISTS:
		return "KEY_NOT_EXISTS"
	}
	return "<UNSET>"
}

func StatusFromString(s string) (Status, error) {
	switch s {
	case "SUCCESS":
		return Status_SUCCESS, nil
	case "FAILURE":
		return Status_FAILURE, nil
	case "KEY_EXISTS":
		return Status_KEY_EXISTS, nil
	case "KEY_NOT_EXISTS":
		return Status_KEY_NOT_EXISTS, nil
	}
	return Status(0), fmt.Errorf("not a valid Status string")
}

func StatusPtr(v Status) *Status { return &v }

func (p Status) MarshalText() ([]byte, error) {
	return []byte(p.String()), nil
}

func (p *Status) UnmarshalText(text []byte) error {
	q, err := StatusFromString(string(text))
	if err != nil {
		return err
	}
	*p = q
	return nil
}

// Attributes:
//  - Key
//  - Expiry
type AddLogCmd struct {
	Key    string `thrift:"Key,1" json:"Key"`
	Expiry int64  `thrift:"Expiry,2" json:"Expiry"`
}

func NewAddLogCmd() *AddLogCmd {
	return &AddLogCmd{}
}

func (p *AddLogCmd) GetKey() string {
	return p.Key
}

func (p *AddLogCmd) GetExpiry() int64 {
	return p.Expiry
}
func (p *AddLogCmd) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if err := p.readField1(iprot); err != nil {
				return err
			}
		case 2:
			if err := p.readField2(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

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

func (p *AddLogCmd) readField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.Expiry = v
	}
	return nil
}

func (p *AddLogCmd) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("AddLogCmd"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField1(oprot); err != nil {
		return err
	}
	if err := p.writeField2(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *AddLogCmd) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Key", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:Key: ", p), err)
	}
	if err := oprot.WriteString(string(p.Key)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.Key (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:Key: ", p), err)
	}
	return err
}

func (p *AddLogCmd) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Expiry", thrift.I64, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:Expiry: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Expiry)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.Expiry (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:Expiry: ", p), err)
	}
	return err
}

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

// Attributes:
//  - Key
//  - Data
//  - Expiry
type UpdateLogCmd struct {
	Key    string `thrift:"Key,1" json:"Key"`
	Data   []byte `thrift:"Data,2" json:"Data"`
	Expiry int64  `thrift:"Expiry,3" json:"Expiry"`
}

func NewUpdateLogCmd() *UpdateLogCmd {
	return &UpdateLogCmd{}
}

func (p *UpdateLogCmd) GetKey() string {
	return p.Key
}

func (p *UpdateLogCmd) GetData() []byte {
	return p.Data
}

func (p *UpdateLogCmd) GetExpiry() int64 {
	return p.Expiry
}
func (p *UpdateLogCmd) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if err := p.readField1(iprot); err != nil {
				return err
			}
		case 2:
			if err := p.readField2(iprot); err != nil {
				return err
			}
		case 3:
			if err := p.readField3(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

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

func (p *UpdateLogCmd) readField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadBinary(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.Data = v
	}
	return nil
}

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

func (p *UpdateLogCmd) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("UpdateLogCmd"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField1(oprot); err != nil {
		return err
	}
	if err := p.writeField2(oprot); err != nil {
		return err
	}
	if err := p.writeField3(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *UpdateLogCmd) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Key", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:Key: ", p), err)
	}
	if err := oprot.WriteString(string(p.Key)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.Key (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:Key: ", p), err)
	}
	return err
}

func (p *UpdateLogCmd) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Data", thrift.STRING, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:Data: ", p), err)
	}
	if err := oprot.WriteBinary(p.Data); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.Data (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:Data: ", p), err)
	}
	return err
}

func (p *UpdateLogCmd) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Expiry", thrift.I64, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:Expiry: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Expiry)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.Expiry (3) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:Expiry: ", p), err)
	}
	return err
}

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

// Attributes:
//  - Key
//  - Data
//  - Expiry
type UpdateLogMValCmd struct {
	Key    string   `thrift:"Key,1" json:"Key"`
	Data   [][]byte `thrift:"Data,2" json:"Data"`
	Expiry int64    `thrift:"Expiry,3" json:"Expiry"`
}

func NewUpdateLogMValCmd() *UpdateLogMValCmd {
	return &UpdateLogMValCmd{}
}

func (p *UpdateLogMValCmd) GetKey() string {
	return p.Key
}

func (p *UpdateLogMValCmd) GetData() [][]byte {
	return p.Data
}

func (p *UpdateLogMValCmd) GetExpiry() int64 {
	return p.Expiry
}
func (p *UpdateLogMValCmd) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if err := p.readField1(iprot); err != nil {
				return err
			}
		case 2:
			if err := p.readField2(iprot); err != nil {
				return err
			}
		case 3:
			if err := p.readField3(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

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

func (p *UpdateLogMValCmd) readField2(iprot thrift.TProtocol) error {
	_, size, err := iprot.ReadListBegin()
	if err != nil {
		return thrift.PrependError("error reading list begin: ", err)
	}
	tSlice := make([][]byte, 0, size)
	p.Data = tSlice
	for i := 0; i < size; i++ {
		var _elem0 []byte
		if v, err := iprot.ReadBinary(); err != nil {
			return thrift.PrependError("error reading field 0: ", err)
		} else {
			_elem0 = v
		}
		p.Data = append(p.Data, _elem0)
	}
	if err := iprot.ReadListEnd(); err != nil {
		return thrift.PrependError("error reading list end: ", err)
	}
	return nil
}

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

func (p *UpdateLogMValCmd) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("UpdateLogMValCmd"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField1(oprot); err != nil {
		return err
	}
	if err := p.writeField2(oprot); err != nil {
		return err
	}
	if err := p.writeField3(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *UpdateLogMValCmd) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Key", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:Key: ", p), err)
	}
	if err := oprot.WriteString(string(p.Key)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.Key (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:Key: ", p), err)
	}
	return err
}

func (p *UpdateLogMValCmd) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Data", thrift.LIST, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:Data: ", p), err)
	}
	if err := oprot.WriteListBegin(thrift.STRING, len(p.Data)); err != nil {
		return thrift.PrependError("error writing list begin: ", err)
	}
	for _, v := range p.Data {
		if err := oprot.WriteBinary(v); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
		}
	}
	if err := oprot.WriteListEnd(); err != nil {
		return thrift.PrependError("error writing list end: ", err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:Data: ", p), err)
	}
	return err
}

func (p *UpdateLogMValCmd) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Expiry", thrift.I64, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:Expiry: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Expiry)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.Expiry (3) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:Expiry: ", p), err)
	}
	return err
}

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

// Attributes:
//  - Key
//  - Expiry
type UpdateExpiryCmd struct {
	Key    string `thrift:"Key,1" json:"Key"`
	Expiry int64  `thrift:"Expiry,2" json:"Expiry"`
}

func NewUpdateExpiryCmd() *UpdateExpiryCmd {
	return &UpdateExpiryCmd{}
}

func (p *UpdateExpiryCmd) GetKey() string {
	return p.Key
}

func (p *UpdateExpiryCmd) GetExpiry() int64 {
	return p.Expiry
}
func (p *UpdateExpiryCmd) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if err := p.readField1(iprot); err != nil {
				return err
			}
		case 2:
			if err := p.readField2(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

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

func (p *UpdateExpiryCmd) readField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.Expiry = v
	}
	return nil
}

func (p *UpdateExpiryCmd) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("UpdateExpiryCmd"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField1(oprot); err != nil {
		return err
	}
	if err := p.writeField2(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *UpdateExpiryCmd) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Key", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:Key: ", p), err)
	}
	if err := oprot.WriteString(string(p.Key)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.Key (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:Key: ", p), err)
	}
	return err
}

func (p *UpdateExpiryCmd) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Expiry", thrift.I64, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:Expiry: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Expiry)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.Expiry (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:Expiry: ", p), err)
	}
	return err
}

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

// Attributes:
//  - Key
//  - Status
//  - Cardinality
type CardinalityResponse struct {
	Key         string `thrift:"Key,1" json:"Key"`
	Status      Status `thrift:"Status,2" json:"Status"`
	Cardinality int64  `thrift:"Cardinality,3" json:"Cardinality"`
}

func NewCardinalityResponse() *CardinalityResponse {
	return &CardinalityResponse{}
}

func (p *CardinalityResponse) GetKey() string {
	return p.Key
}

func (p *CardinalityResponse) GetStatus() Status {
	return p.Status
}

func (p *CardinalityResponse) GetCardinality() int64 {
	return p.Cardinality
}
func (p *CardinalityResponse) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if err := p.readField1(iprot); err != nil {
				return err
			}
		case 2:
			if err := p.readField2(iprot); err != nil {
				return err
			}
		case 3:
			if err := p.readField3(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

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

func (p *CardinalityResponse) readField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		temp := Status(v)
		p.Status = temp
	}
	return nil
}

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

func (p *CardinalityResponse) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("CardinalityResponse"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField1(oprot); err != nil {
		return err
	}
	if err := p.writeField2(oprot); err != nil {
		return err
	}
	if err := p.writeField3(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *CardinalityResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Key", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:Key: ", p), err)
	}
	if err := oprot.WriteString(string(p.Key)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.Key (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:Key: ", p), err)
	}
	return err
}

func (p *CardinalityResponse) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Status", thrift.I32, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:Status: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.Status)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.Status (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:Status: ", p), err)
	}
	return err
}

func (p *CardinalityResponse) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Cardinality", thrift.I64, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:Cardinality: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Cardinality)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.Cardinality (3) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:Cardinality: ", p), err)
	}
	return err
}

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


text:
namespace Checkpoints
{
    typedef std::map<int, uint256> MapCheckpoints;

    // How many times we expect transactions after the last checkpoint to
    // be slower. This number is a compromise, as it can't be accurate for
    // every system. When reindexing from a fast disk with a slow CPU, it
    // can be up to 20, while when downloading from a slow network with a
    // fast multicore CPU, it won't be much higher than 1.
    static const double fSigcheckVerificationFactor = 5.0;

    struct CCheckpointData {
        const MapCheckpoints *mapCheckpoints;
        int64 nTimeLastCheckpoint;
        int64 nTransactionsLastCheckpoint;
        double fTransactionsPerDay;
    };

    // What makes a good checkpoint block?
    // + Is surrounded by blocks with reasonable timestamps
    //   (no blocks before with a timestamp after, none after with
    //    timestamp before)
    // + Contains no strange transactions
    static MapCheckpoints mapCheckpoints =
        boost::assign::map_list_of
        ( 0, uint256("0x4e56204bb7b8ac06f860ff1c845f03f984303b5b97eb7b42868f714611aed94b"))
        ( 14871, uint256("0x5dedc3dd860f008c717d69b8b00f0476de8bc6bdac8d543fb58c946f32f982fa"))
        ( 36032, uint256("0xff37468190b2801f2e72eb1762ca4e53cda6c075af48343f28a32b649512e9a8"))
        ( 51365, uint256("0x702b407c68091f3c97a587a8d92684666bb622f6821944424b850964b366e42c"))
        ;

    static const CCheckpointData data = {
       &mapCheckpoints,
          1396699732, // * UNIX timestamp of last checkpoint block
          279028,    // * total number of transactions between genesis and last checkpoint
                    //   (the tx=... number in the SetBestChain debug.log lines)
          8000     // * estimated number of transactions per day after checkpoint
    };

    static MapCheckpoints mapCheckpointsTestnet;

    static const CCheckpointData dataTestnet = {
        &mapCheckpointsTestnet,
        1369685559,
        37581,
        300
    };

    const CCheckpointData &Checkpoints() {
        if (fTestNet)
            return dataTestnet;
        else
            return data;
    }

    bool CheckBlock(int nHeight, const uint256& hash)
    {
	if (fTestNet) return true; // Testnet has no checkpoints
        if (!GetBoolArg("-checkpoints", true))
            return true;

        const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;

        MapCheckpoints::const_iterator i = checkpoints.find(nHeight);
        if (i == checkpoints.end()) return true;
        return hash == i->second;;
    }

    // Guess how far we are in the verification process at the given block index

    double GuessVerificationProgress(CBlockIndex *pindex) {
        if (pindex==NULL)
            return 0.0;

        int64 nNow = time(NULL);

        double fWorkBefore = 0.0; // Amount of work done before pindex
        double fWorkAfter = 0.0;  // Amount of work left after pindex (estimated)
        // Work is defined as: 1.0 per transaction before the last checkoint, and
        // fSigcheckVerificationFactor per transaction after.

        const CCheckpointData &data = Checkpoints();

        if (pindex->nChainTx <= data.nTransactionsLastCheckpoint) {
            double nCheapBefore = pindex->nChainTx;
            double nCheapAfter = data.nTransactionsLastCheckpoint - pindex->nChainTx;
            double nExpensiveAfter = (nNow - data.nTimeLastCheckpoint)/86400.0*data.fTransactionsPerDay;
            fWorkBefore = nCheapBefore;
            fWorkAfter = nCheapAfter + nExpensiveAfter*fSigcheckVerificationFactor;
        } else {
            double nCheapBefore = data.nTransactionsLastCheckpoint;
            double nExpensiveBefore = pindex->nChainTx - data.nTransactionsLastCheckpoint;
            double nExpensiveAfter = (nNow - pindex->nTime)/86400.0*data.fTransactionsPerDay;
            fWorkBefore = nCheapBefore + nExpensiveBefore*fSigcheckVerificationFactor;
            fWorkAfter = nExpensiveAfter*fSigcheckVerificationFactor;
        }

        return fWorkBefore / (fWorkBefore + fWorkAfter);
    }

    int GetTotalBlocksEstimate()
    {
        if (fTestNet) return 0; // Testnet has no checkpoints
        if (!GetBoolArg("-checkpoints", true))
            return 0;

        const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;

        return checkpoints.rbegin()->first;

    }

    CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex)
    {
        if (fTestNet) return NULL; // Testnet has no checkpoints
        if (!GetBoolArg("-checkpoints", true))
            return NULL;

        const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;

        BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints)
        {
            const uint256& hash = i.second;
            std::map<uint256, CBlockIndex*>::const_iterator t = mapBlockIndex.find(hash);
            if (t != mapBlockIndex.end())
                return t->second;
        }
        return NULL;
    }
}


text:
+++
title = "Listener Development"
weight = 1
chapter = true
+++

## Common Listener

If the job processes the files of the job server and deletes the files after the processing is completed, consider using each node to perform the cleaning task.
This type of task is simple to implement, and there is no need to consider whether the global distributed task is completed. You should try to use this type of listener.

```java

public class MyJobListener implements ElasticJobListener {

    @Override
    public void beforeJobExecuted(ShardingContexts shardingContexts) {
        // do something ...
    }

    @Override
    public void afterJobExecuted(ShardingContexts shardingContexts) {
        // do something ...
    }

    @Override
    public String getType() {
        return "simpleJobListener";
    }
}
```

## Distributed Listener

If the job processes database data, only one node needs to complete the data cleaning task after the processing is completed.
This type of task is complicated to process and needs to synchronize the status of the job in a distributed environment. Timeout settings are provided to avoid deadlocks caused by job out of sync. It should be used with caution.

```java

public class MyDistributeOnceJobListener extends AbstractDistributeOnceElasticJobListener {

    public TestDistributeOnceElasticJobListener(long startTimeoutMills, long completeTimeoutMills) {
        super(startTimeoutMills, completeTimeoutMills);
    }

    @Override
    public void doBeforeJobExecutedAtLastStarted(ShardingContexts shardingContexts) {
        // do something ...
    }

    @Override
    public void doAfterJobExecutedAtLastCompleted(ShardingContexts shardingContexts) {
        // do something ...
    }

    @Override
    public String getType() {
        return "distributeOnceJobListener";
    }
}
```

## Add SPI implementation

Put JobListener implementation to module infra-common, resources/META-INF/services/org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener


text:
package com.google.android.exoplayer2.text.cea;

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

/** Initialization data for CEA-708 decoders. */
public final class Cea708InitializationData {

  /**
   * Whether the closed caption service is formatted for displays with 16:9 aspect ratio. If false,
   * the closed caption service is formatted for 4:3 displays.
   */
  public final boolean isWideAspectRatio;

  private Cea708InitializationData(List<byte[]> initializationData) {
    isWideAspectRatio = initializationData.get(0)[0] != 0;
  }

  /**
   * Returns an object representation of CEA-708 initialization data
   *
   * @param initializationData Binary CEA-708 initialization data.
   * @return The object representation.
   */
  public static Cea708InitializationData fromData(List<byte[]> initializationData) {
    return new Cea708InitializationData(initializationData);
  }

  /**
   * Builds binary CEA-708 initialization data.
   *
   * @param isWideAspectRatio Whether the closed caption service is formatted for displays with 16:9
   *     aspect ratio.
   * @return Binary CEA-708 initializaton data.
   */
  public static List<byte[]> buildData(boolean isWideAspectRatio) {
    return Collections.singletonList(new byte[] {(byte) (isWideAspectRatio ? 1 : 0)});
  }
}


text:
package org.sleuthkit.autopsy.integrationtesting;

import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestCase;
import org.netbeans.junit.NbModuleSuite;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.integrationtesting.IntegrationTestService.IntegrationTestDiffException;
import org.sleuthkit.autopsy.integrationtesting.IntegrationTestService.IntegrationTestServiceException;

/**
 * Main entry point for running integration tests. Handles processing
 * parameters, ingesting data sources for cases, and running items implementing
 * IntegrationTests.
 */
public class TestRunner extends TestCase {

    /**
     * Constructor required by JUnit
     */
    public TestRunner(String name) {
        super(name);
    }

    /**
     * Creates suite from particular test cases.
     */
    public static Test suite() {
        NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(TestRunner.class).
                clusters(".*").
                enableModules(".*");

        return NbModuleSuite.create(conf.addTest("runIntegrationTests"));
    }

    public void runIntegrationTests() {
        IntegrationTestService testService = new IntegrationTestService();
        try {
            testService.runIntegrationTests();
        } catch (IntegrationTestDiffException ex) {
            Assert.fail(ex.getMessage());
        } catch (IntegrationTestServiceException ex) {
            Exceptions.printStackTrace(ex);
            Assert.fail("An exception occurred that prevented the operation of these integration tests: " + ex.getMessage());
        }
    }

}


text:
namespace Microsoft.Azure.Management.Cdn.Models
{
    using Microsoft.Rest;
    using Newtonsoft.Json;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;

    /// <summary>
    /// Defines the parameters for the URL file extension condition.
    /// </summary>
    public partial class UrlFileExtensionConditionParameters
    {
        /// <summary>
        /// Initializes a new instance of the
        /// UrlFileExtensionConditionParameters class.
        /// </summary>
        public UrlFileExtensionConditionParameters()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the
        /// UrlFileExtensionConditionParameters class.
        /// </summary>
        /// <param name="extensions">A list of extensions for the condition of
        /// the delivery rule.</param>
        public UrlFileExtensionConditionParameters(IList<string> extensions)
        {
            Extensions = extensions;
            CustomInit();
        }
        /// <summary>
        /// Static constructor for UrlFileExtensionConditionParameters class.
        /// </summary>
        static UrlFileExtensionConditionParameters()
        {
            Odatatype = "Microsoft.Azure.Cdn.Models.DeliveryRuleUrlFileExtensionConditionParameters";
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

        /// <summary>
        /// Gets or sets a list of extensions for the condition of the delivery
        /// rule.
        /// </summary>
        [JsonProperty(PropertyName = "extensions")]
        public IList<string> Extensions { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "@odata.type")]
        public static string Odatatype { get; private set; }

        /// <summary>
        /// Validate the object.
        /// </summary>
        /// <exception cref="ValidationException">
        /// Thrown if validation fails
        /// </exception>
        public virtual void Validate()
        {
            if (Extensions == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "Extensions");
            }
        }
    }
}


text:
/****************************************************************************
 * examples/examples/sensorbd/examples/pwm_buzzer.c
 *
 *   Copyright (C) 2012 Gregory Nutt. All rights reserved.
 *   Author: Gregory Nutt <gnutt@nuttx.org>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 * 3. Neither the name NuttX nor the names of its contributors may be
 *    used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 ****************************************************************************/

#include <fcntl.h>
#include <tinyara/pwm.h>

#define C4   262
#define D4   294
#define E4   330
#define F4   349
#define G4   392
#define A4   440
#define B4   494
#define C5   523
#define D5   587
#define E5   659
#define F5   698
#define G5   784
#define A5   880
#define B5   988
#define C6   1047

int octavef1[8] = { C4, D4, E4, F4, G4, A4, B4, C5 };
int octavef2[8] = { C5, D5, E5, F5, G5, A5, B5, C6 };
int octaved[8] = { 8, 8, 8, 8, 8, 8, 8, 8 };

void pwmbuzzer_main(int argc, char *argv[])
{
	int i, fd;
	struct pwm_info_s pwm_info;

	/* device 0 channel 1 */
	fd = open("/dev/pwm1", O_RDWR);
	if (fd < 0) {
		printf("fd open fail\n");
		return;
	}

	for (i = 0; i < 8; i++) {
		pwm_info.frequency = octavef1[i];
		pwm_info.duty = (octaved[i] * 65536) / 100;
		ioctl(fd, PWMIOC_SETCHARACTERISTICS, (unsigned long)((uintptr_t)&pwm_info));
		ioctl(fd, PWMIOC_START);

		up_mdelay(400);
	}

	ioctl(fd, PWMIOC_STOP);
	close(fd);

	up_mdelay(1000);

	/* device 0 channel 2 */
	fd = open("/dev/pwm2", O_RDWR);
	if (fd < 0) {
		printf("fd open fail\n");
		return;
	}

	for (i = 0; i < 8; i++) {
		pwm_info.frequency = octavef2[i];
		pwm_info.duty = (octaved[i] * 65536) / 100;
		ioctl(fd, PWMIOC_SETCHARACTERISTICS, (unsigned long)((uintptr_t)&pwm_info));
		ioctl(fd, PWMIOC_START);

		up_mdelay(400);
	}

	ioctl(fd, PWMIOC_STOP);
	close(fd);
}


text:
using _05.BarracksFactory_DI.Attributes;
using _05.BarracksFactory_DI.Contracts;

namespace _05.BarracksFactory_DI.Core.Commands
{
    public class ReportCommand : Command
    {
        [Inject]
        private readonly IRepository repository;

        public ReportCommand(string[] data, IRepository repository) : base(data)
        {
            this.repository = repository;
        }

        public override string Execute()
        {
            string output = this.repository.Statistics;
            return output;
        }
    }
}


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Dashboard for /home/gerard/sites/modules.w.doctrine/modules.zendframework.com/module/ZendDeveloperTools</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link href="css/bootstrap-responsive.min.css" rel="stylesheet">
  <link href="css/style.css" rel="stylesheet">

/home/gerard/sites/modules.w.doctrine/modules.zendframework.com /

module /

ZendDeveloperTools

(Dashboard)

Class Coverage Distribution

Class Complexity

Top Project Risks

Module (223)

Least Tested Methods

Module::onLoadModulesPost (0%)

Module::onBootstrap (9%)

Module::anonymous function (11%)

Module::init (33%)

Module::getServiceConfig (65%)

     Generated by PHP_CodeCoverage 1.2.13 using PHP 5.3.10-1ubuntu3.8 and PHPUnit 3.7.27 at Sat Oct 12 3:31:18 CEST 2013.


text:
<?php
/****************************************************************
* Write these filter into your theme's functions.php to make plugin
* compatible to your theme, You can use all of selective filters
* according to your need.
*****************************************************************/

/*
  * Filter for Custom options
  */
function apply_ebs_custom_option( $prevent ) {
	return true;
}
add_filter( 'ebs_custom_option', 'apply_ebs_custom_option' );

/*
 *Filter for bootstrap_admin.css
 */
function apply_ebs_custom_bootstrap_admin_css( $prevent ) {
	return true;
}
add_filter( 'ebs_custom_bootstrap_admin_css', 'apply_ebs_custom_bootstrap_admin_css' );

/*
  * Filter for bootstrap.min.js url this filter is only applicable if you selected js inclusion from plugin in EBS Settings
  */

function apply_ebs_bootstrap_js_url( $url ) {
	$ebs_js_url='';// write your desired bootstrap.min.js url here
	return $ebs_js_url;
}
add_filter( 'ebs_bootstrap_js_url', 'apply_ebs_bootstrap_js_url' );

/*
  * Filter for bootstrap.min.js CDN path this filter is only applicable if you selected js inclusion from CDN in EBS Settings
  */

function apply_ebs_bootstrap_js_cdn( $url ) {
	$ebs_cdn_url='';// write your bootstrap.min.js cdn path here
	return $ebs_cdn_url;
}
add_filter( 'ebs_bootstrap_js_cdn', 'apply_ebs_bootstrap_js_cdn' );

function apply_ebs_bootstrap_respond_url( $url ) {
	$ebs_respond_url='';// write your desired bootstrap.min.js url here
	return $ebs_respond_url;
}
add_filter( 'ebs_bootstrap_respond_url', 'apply_ebs_bootstrap_respond_url' );

/*
  * Filter for respond.min.js CDN path this filter is only applicable if you selected js inclusion from CDN in EBS Settings
  */

function apply_ebs_bootstrap_respond_cdn( $url ) {
	$ebs_respond_cdn_url='';// write your bootstrap.min.js cdn path here
	return $ebs_respond_cdn_url;
}
add_filter( 'ebs_bootstrap_respond_cdn', 'apply_ebs_bootstrap_respond_cdn' );

/*
  * Filter for bootstrap.min.css urlthis filter is only applicable if you selected css inclusion from plugin in EBS Settings
  */

function apply_ebs_bootstrap_css_url( $url ) {
	$ebs_css_url='';// write your bootstrap.min.css  url here
	return $ebs_css_url;
}
add_filter( 'ebs_bootstrap_css_url', 'apply_ebs_bootstrap_css_url' );

/*
  * Filter for custom bootstrap css when your theme is not a bootstrap theme. this filter is only applicable if you selected css inclusion option as 'no bootstrap theme'
  */

function apply_ebs_no_bootstrap_theme_css_url( $url ) {
	$ebs_nobs_css_url='';// write your custom bootstrap css  url here
	return $ebs_nobs_css_url;
}
add_filter( 'ebs_no_bootstrap_theme_css_url', 'apply_ebs_no_bootstrap_theme_css_url' );

/*
  * Filter for bootstrap-icon.min.css url this filter is only applicable if you selected css inclusion from plugin or theme in EBS Settings
  */

function apply_ebs_bootstrap_icon_css_url( $url ) {
	$ebs_icon_url='';// write your bootstrap-icon.min.css url here
	return $ebs_icon_url;
}
add_filter( 'ebs_bootstrap_icon_css_url', 'apply_ebs_bootstrap_icon_css_url' );
?>


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="@dimen/issue_card_height"
    app:cardElevation="50dp"
    app:contentPadding="15dp"
    android:clickable="true"
    android:foreground="?android:attr/selectableItemBackground"
    app:cardCornerRadius="12dp"
    app:cardBackgroundColor="@color/app_textword_color"
    android:layout_marginTop="@dimen/item_margin_top"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp">

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

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_marginTop="5dp"
            android:orientation="horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/datetime_text_issue_item"
                android:text="2017 21 Apr "
                android:layout_weight="1"
                android:textColor="@color/app_hint_color"
                android:layout_alignParentTop="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="17dp"
                android:id="@+id/author_text_issue_item"
                android:text="林宗億"
                android:layout_weight="5"
                android:textColor="#646464"
                android:layout_alignParentTop="true"
                android:layout_toRightOf="@+id/datetime_text_issue_item"
                android:layout_toEndOf="@+id/datetime_text_issue_item"
                android:layout_marginStart="17dp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_weight="1"
                android:id="@+id/title_text_issue_item"
                android:text="功能"
                android:textColor="@color/app_black_word_color"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_weight="1"
                android:gravity="end"
                android:id="@+id/type_text_issue_item"
                android:text="投票"
                android:textColor="@color/app_hint_color"/>

        </LinearLayout>
    </RelativeLayout>

</android.support.v7.widget.CardView>


text:
package com.melotic.api.dto;

import java.util.HashMap;
import java.util.Map;

public class MarketMap extends HashMap<MarketId, Market>
{
    @Override public Market put(MarketId key, Market value)
    {
        if (value != null)
        {
            value.id = key;
        }
        return super.put(key, value);
    }

    @Override public void putAll(Map<? extends MarketId, ? extends Market> map)
    {
        for (Map.Entry<? extends MarketId, ? extends Market> entry : map.entrySet())
        {
            entry.getValue().id = entry.getKey();
        }
        super.putAll(map);
    }
}


text:
namespace _01.Euclidian3D.Models
{
    using  System.Collections.Generic;
    using System.Collections;
    public class Path : IEnumerable<Point3D>
    {
        private ICollection<Point3D> points;

        public Path()
        {
            this.points = new HashSet<Point3D>();
        }

        public void AddPoint(Point3D point)
        {
            this.points.Add(point);
        }

        public void RemovePoint(Point3D point)
        {
            this.points.Remove(point);
        }

        public IEnumerator<Point3D> GetEnumerator()
        {
            return this.points.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
    }
}


text:
namespace Aerospike.Client
{
	/// <summary>
	/// Database operation error codes.
	/// </summary>
	public sealed class ResultCode
	{
		/// <summary>
		/// Asynchronous max concurrent database commands have been exceeded and therefore rejected.
		/// </summary>
		public const int COMMAND_REJECTED = -6;

		/// <summary>
		/// Query was terminated by user.
		/// </summary>
		public const int QUERY_TERMINATED = -5;

		/// <summary>
		/// Scan was terminated by user.
		/// </summary>
		public const int SCAN_TERMINATED = -4;

		/// <summary>
		/// Chosen node is not currently active.
		/// </summary>
		public const int INVALID_NODE_ERROR = -3;

		/// <summary>
		/// Client parse error.
		/// </summary>
		public const int PARSE_ERROR = -2;

		/// <summary>
		/// Client serialization error.
		/// </summary>
		public const int SERIALIZE_ERROR = -1;

		/// <summary>
		/// Operation was successful.
		/// </summary>
		public const int OK = 0;

		/// <summary>
		/// Unknown server failure.
		/// </summary>
		public const int SERVER_ERROR = 1;

		/// <summary>
		/// On retrieving, touching or replacing a record that doesn't exist.
		/// </summary>
		public const int KEY_NOT_FOUND_ERROR = 2;

		/// <summary>
		/// On modifying a record with unexpected generation.
		/// </summary>
		public const int GENERATION_ERROR = 3;

		/// <summary>
		/// Bad parameter(s) were passed in database operation call.
		/// </summary>
		public const int PARAMETER_ERROR = 4;

		/// <summary>
		/// On create-only (write unique) operations on a record that already
		/// exists.
		/// </summary>
		public const int KEY_EXISTS_ERROR = 5;

		/// <summary>
		/// On create-only (write unique) operations on a bin that already
		/// exists.
		/// </summary>
		public const int BIN_EXISTS_ERROR = 6;

		/// <summary>
		/// Expected cluster ID was not received.
		/// </summary>
		public const int CLUSTER_KEY_MISMATCH = 7;

		/// <summary>
		/// Server has run out of memory.
		/// </summary>
		public const int SERVER_MEM_ERROR = 8;

		/// <summary>
		/// Client or server has timed out.
		/// </summary>
		public const int TIMEOUT = 9;

		/// <summary>
		/// XDS product is not available.
		/// </summary>
		public const int NO_XDS = 10;

		/// <summary>
		/// Server is not accepting requests.
		/// </summary>
		public const int SERVER_NOT_AVAILABLE = 11;

		/// <summary>
		/// Operation is not supported with configured bin type (single-bin or
		/// multi-bin).
		/// </summary>
		public const int BIN_TYPE_ERROR = 12;

		/// <summary>
		/// Record size exceeds limit.
		/// </summary>
		public const int RECORD_TOO_BIG = 13;

		/// <summary>
		/// Too many concurrent operations on the same record.
		/// </summary>
		public const int KEY_BUSY = 14;

		/// <summary>
		/// Scan aborted by server.
		/// </summary>
		public const int SCAN_ABORT = 15;

		/// <summary>
		/// Client operation not supported on connected server.
		/// </summary>
		public const int UNSUPPORTED_FEATURE = 16;

		/// <summary>
		/// Specified bin name does not exist in record.
		/// </summary>
		public const int BIN_NOT_FOUND = 17;

		/// <summary>
		/// Device not keeping up with writes.
		/// </summary>
		public const int DEVICE_OVERLOAD = 18;

		/// <summary>
		/// Key type mismatch.
		/// </summary>
		public const int KEY_MISMATCH = 19;

		/// <summary>
		/// Invalid namespace.
		/// </summary>
		public const int INVALID_NAMESPACE = 20;

		/// <summary>
		/// Bin name length greater than 14 characters.
		/// </summary>
		public const int BIN_NAME_TOO_LONG = 21;

		/// <summary>
		/// Operation not allowed at this time.
		/// </summary>
		public const int FAIL_FORBIDDEN = 22;

		/// <summary>
		/// There are no more records left for query.
		/// </summary>
		public const int QUERY_END = 50;

		/// <summary>
		/// Security functionality not supported by connected server.
		/// </summary>
		public const int SECURITY_NOT_SUPPORTED = 51;

		/// <summary>
		/// Security functionality supported, but not enabled by connected server.
		/// </summary>
		public const int SECURITY_NOT_ENABLED = 52;

		/// <summary>
		/// Security configuration not supported.
		/// </summary>
		public const int SECURITY_SCHEME_NOT_SUPPORTED = 53;

		/// <summary>
		/// Administration command is invalid.
		/// </summary>
		public const int INVALID_COMMAND = 54;

		/// <summary>
		/// Administration field is invalid.
		/// </summary>
		public const int INVALID_FIELD = 55;

		/// <summary>
		/// Server is in illegal stage.
		/// </summary>
		public const int ILLEGAL_STATE = 56;

		/// <summary>
		/// User name is invalid.
		/// </summary>
		public const int INVALID_USER = 60;

		/// <summary>
		/// User was previously created.
		/// </summary>
		public const int USER_ALREADY_EXISTS = 61;

		/// <summary>
		/// Password is invalid.
		/// </summary>
		public const int INVALID_PASSWORD = 62;

		/// <summary>
		/// Password has expired.
		/// </summary>
		public const int EXPIRED_PASSWORD = 63;

		/// <summary>
		/// Forbidden password (e.g. recently used)
		/// </summary>
		public const int FORBIDDEN_PASSWORD = 64;

		/// <summary>
		/// Security credential is invalid.
		/// </summary>
		public const int INVALID_CREDENTIAL = 65;

		/// <summary>
		/// Role name is invalid.
		/// </summary>
		public const int INVALID_ROLE = 70;

		/// <summary>
		/// Role already exists.
		/// </summary>
		public const int ROLE_ALREADY_EXISTS = 71;

		/// <summary>
		/// Specified Privilege is not valid.
		/// </summary>
		public const int INVALID_PRIVILEGE = 72;

		/// <summary>
		/// User must be authentication before performing database operations.
		/// </summary>
		public const int NOT_AUTHENTICATED = 80;

		/// <summary>
		/// User does not posses the required role to perform the database operation.
		/// </summary>
		public const int ROLE_VIOLATION = 81;

		/// <summary>
		/// A user defined function returned an error code.
		/// </summary>
		public const int UDF_BAD_RESPONSE = 100;

		/// <summary>
		/// The requested item in a large collection was not found.
		/// </summary>
		public const int LARGE_ITEM_NOT_FOUND = 125;

		/// <summary>
		/// Batch functionality has been disabled.
		/// </summary>
		public const int BATCH_DISABLED = 150;

		/// <summary>
		/// Batch max requests have been exceeded.
		/// </summary>
		public const int BATCH_MAX_REQUESTS_EXCEEDED = 151;

		/// <summary>
		/// All batch queues are full.
		/// </summary>
		public const int BATCH_QUEUES_FULL = 152;

		/// <summary>
		/// Secondary index already exists.
		/// </summary>
		public const int INDEX_FOUND = 200;

		/// <summary>
		/// Requested secondary index does not exist.
		/// </summary>
		public const int INDEX_NOTFOUND = 201;

		/// <summary>
		/// Secondary index memory space exceeded.
		/// </summary>
		public const int INDEX_OOM = 202;

		/// <summary>
		/// Secondary index not available.
		/// </summary>
		public const int INDEX_NOTREADABLE = 203;

		/// <summary>
		/// Generic secondary index error.
		/// </summary>
		public const int INDEX_GENERIC = 204;

		/// <summary>
		/// Index name maximum length exceeded.
		/// </summary>
		public const int INDEX_NAME_MAXLEN = 205;

		/// <summary>
		/// Maximum number of indicies exceeded.
		/// </summary>
		public const int INDEX_MAXCOUNT = 206;

		/// <summary>
		/// Secondary index query aborted.
		/// </summary>
		public const int QUERY_ABORTED = 210;

		/// <summary>
		/// Secondary index queue full.
		/// </summary>
		public const int QUERY_QUEUEFULL = 211;

		/// <summary>
		/// Secondary index query timed out on server.
		/// </summary>
		public const int QUERY_TIMEOUT = 212;

		/// <summary>
		/// Generic query error.
		/// </summary>
		public const int QUERY_GENERIC = 213;

		/// <summary>
		/// Should connection be put back into pool.
		/// </summary>
		public static bool KeepConnection(int resultCode)
		{
			switch (resultCode)
			{
				case 0: // Exception did not originate on server.
				case QUERY_TERMINATED:
				case SCAN_TERMINATED:
				case INVALID_NODE_ERROR:
				case PARSE_ERROR:
				case SERIALIZE_ERROR:
				case SERVER_MEM_ERROR:
				case TIMEOUT:
				case SERVER_NOT_AVAILABLE:
				case SCAN_ABORT:
				case INDEX_OOM:
				case QUERY_ABORTED:
				case QUERY_TIMEOUT:
					return false;

				default:
					return true;
			}
		}

		/// <summary>
		/// Return result code as a string.
		/// </summary>
		public static string GetResultString(int resultCode)
		{
			switch (resultCode)
			{
			case COMMAND_REJECTED:
				return "Command rejected";

			case QUERY_TERMINATED:
				return "Query terminated";

			case SCAN_TERMINATED:
				return "Scan terminated";

			case INVALID_NODE_ERROR:
				return "Invalid node";

			case PARSE_ERROR:
				return "Parse error";

			case SERIALIZE_ERROR:
				return "Serialize error";

			case OK:
				return "ok";

			case SERVER_ERROR:
				return "Server error";

			case KEY_NOT_FOUND_ERROR:
				return "Key not found";

			case GENERATION_ERROR:
				return "Generation error";

			case PARAMETER_ERROR:
				return "Parameter error";

			case KEY_EXISTS_ERROR:
				return "Key already exists";

			case BIN_EXISTS_ERROR:
				return "Bin already exists";

			case CLUSTER_KEY_MISMATCH:
				return "Cluster key mismatch";

			case SERVER_MEM_ERROR:
				return "Server memory error";

			case TIMEOUT:
				return "Timeout";

			case NO_XDS:
				return "XDS not available";

			case SERVER_NOT_AVAILABLE:
				return "Server not available";

			case BIN_TYPE_ERROR:
				return "Bin type error";

			case RECORD_TOO_BIG:
				return "Record too big";

			case KEY_BUSY:
				return "Hot key";

			case SCAN_ABORT:
				return "Scan aborted";

			case UNSUPPORTED_FEATURE:
				return "Unsupported server feature";

			case BIN_NOT_FOUND:
				return "Bin not found";

			case DEVICE_OVERLOAD:
				return "Device overload";

			case KEY_MISMATCH:
				return "Key mismatch";

			case INVALID_NAMESPACE:
				return "Namespace not found";

			case BIN_NAME_TOO_LONG:
				return "Bin name length greater than 14 characters";

			case FAIL_FORBIDDEN:
				return "Operation not allowed at this time";

			case QUERY_END:
				return "Query end";

			case SECURITY_NOT_SUPPORTED:
				return "Security not supported";

			case SECURITY_NOT_ENABLED:
				return "Security not enabled";

			case SECURITY_SCHEME_NOT_SUPPORTED:
				return "Security scheme not supported";

			case INVALID_COMMAND:
				return "Invalid command";

			case INVALID_FIELD:
				return "Invalid field";

			case ILLEGAL_STATE:
				return "Illegal state";

			case INVALID_USER:
				return "Invalid user";

			case USER_ALREADY_EXISTS:
				return "User already exists";

			case INVALID_PASSWORD:
				return "Invalid password";

			case EXPIRED_PASSWORD:
				return "Password expired";

			case FORBIDDEN_PASSWORD:
				return "Password can't be reused";

			case INVALID_CREDENTIAL:
				return "Invalid credential";

			case INVALID_ROLE:
				return "Invalid role";

			case ROLE_ALREADY_EXISTS:
				return "Role already exists";

			case INVALID_PRIVILEGE:
				return "Invalid privilege";

			case NOT_AUTHENTICATED:
				return "Not authenticated";

			case ROLE_VIOLATION:
				return "Role violation";

			case UDF_BAD_RESPONSE:
				return "UDF returned error";

			case LARGE_ITEM_NOT_FOUND:
				return "Large collection item not found";

			case BATCH_DISABLED:
				return "Batch functionality has been disabled";

			case BATCH_MAX_REQUESTS_EXCEEDED:
				return "Batch max requests have been exceeded";

			case BATCH_QUEUES_FULL:
				return "All batch queues are full";

			case INDEX_FOUND:
				return "Index already exists";

			case INDEX_NOTFOUND:
				return "Index not found";

			case INDEX_OOM:
				return "Index out of memory";

			case INDEX_NOTREADABLE:
				return "Index not readable";

			case INDEX_GENERIC:
				return "Index error";

			case INDEX_NAME_MAXLEN:
				return "Index name max length exceeded";

			case INDEX_MAXCOUNT:
				return "Index count exceeds max";

			case QUERY_ABORTED:
				return "Query aborted";

			case QUERY_QUEUEFULL:
				return "Query queue full";

			case QUERY_TIMEOUT:
				return "Query timeout";

			case QUERY_GENERIC:
				return "Query error";

			default:
				return "";
			}
		}
	}
}


text:
package org.ngbw.sdk.tool.validation;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.Set;
import org.ngbw.sdk.api.tool.ParameterValidator2;
import org.ngbw.sdk.api.tool.FieldError;
import org.ngbw.sdk.common.util.BaseValidator;
import org.ngbw.sdk.database.TaskInputSourceDocument;
import org.ngbw.sdk.common.util.SuperString;
public class sixpackValidator implements ParameterValidator2
{
private Set<String> requiredParameters;
private Set<String> requiredInput;
private Set<String> allowedParameters;
private Set<String> allowedInput;
// Map of parameter name to list separator (a single character string) for List parameters.
private Map<String, String> listParameters;
// Maps param name to permitted values for List, Excl, Switch type params
private Map<String, List<String>> listValues;
private Map<String, List<String>> exclValues ;
private Map<String, List<String>> switchValues;
private List<FieldError> errors = new ArrayList<FieldError>();
public sixpackValidator() {
requiredParameters = new HashSet<String>();
requiredInput = new HashSet<String>();
allowedParameters = new HashSet<String>();
allowedInput = new HashSet<String>();
listParameters = new HashMap<String, String>();
listValues = new HashMap<String, List<String>>();
exclValues = new HashMap<String, List<String>>();
switchValues = new HashMap<String, List<String>>();
List<String> switchList = new ArrayList<String>(2);
switchList.add("0");
switchList.add("1");
List<String> tmpList;
allowedInput.add("sequence_");
requiredInput.add("sequence_");
tmpList = new ArrayList<String>();
tmpList.add("0");
tmpList.add("1");
tmpList.add("2");
tmpList.add("3");
tmpList.add("4");
tmpList.add("5");
tmpList.add("6");
tmpList.add("9");
tmpList.add("10");
tmpList.add("11");
tmpList.add("12");
tmpList.add("13");
tmpList.add("14");
tmpList.add("15");
tmpList.add("16");
tmpList.add("21");
tmpList.add("22");
tmpList.add("23");
exclValues.put("table_", tmpList);
allowedParameters.add("table_");
requiredParameters.add("table_");
allowedParameters.add("firstorf_");
switchValues.put("firstorf_", switchList);
allowedParameters.add("lastorf_");
switchValues.put("lastorf_", switchList);
allowedParameters.add("mstart_");
switchValues.put("mstart_", switchList);
tmpList = new ArrayList<String>();
tmpList.add("fasta");
tmpList.add("gcg");
tmpList.add("ncbi");
tmpList.add("nbrf");
tmpList.add("text");
exclValues.put("outseq_sformat_", tmpList);
allowedParameters.add("outseq_sformat_");
allowedParameters.add("reverse_");
switchValues.put("reverse_", switchList);
allowedParameters.add("orfminsize_");
allowedParameters.add("uppercase_");
allowedParameters.add("number_");
switchValues.put("number_", switchList);
allowedParameters.add("width_");
allowedParameters.add("length_");
allowedParameters.add("margin_");
allowedParameters.add("name_");
switchValues.put("name_", switchList);
allowedParameters.add("description_");
switchValues.put("description_", switchList);
allowedParameters.add("offset_");
allowedParameters.add("html_");
switchValues.put("html_", switchList);
allowedParameters.add("highlight_");
}
public List<FieldError> getErrors()
{
return errors;
}
public Map<String, String> preProcessParameters(Map<String, List<String>> parameters)
{
Map<String, String> preProcessed = new HashMap<String, String>();
for (String param : parameters.keySet())
{
String newValue;
List<String> values = parameters.get(param);
// Is param of type List?
if (listValues.keySet().contains(param))
{
for (String value : values)
{
List<String> permittedValues = listValues.get(param);
if (!permittedValues.contains(value))
{
errors.add(new FieldError(param, "'" + value + "' is not a permitted value."));
}
}
// concatenate the multiple choices.
String separator = listParameters.get(param);
if (separator != null)
{
newValue = SuperString.valueOf(parameters.get(param), separator.charAt(0)).toString();
} else
{
newValue = SuperString.valueOf(parameters.get(param), '@').toString();
}
} else
{
newValue = parameters.get(param).get(0);
if (parameters.get(param).size() > 1)
{
errors.add(new FieldError(param, "multiple values are not permitted."));
}
if (exclValues.keySet().contains(param))
{
if (!exclValues.get(param).contains(newValue))
{
errors.add(new FieldError(param, "'" + newValue + "' is not a permitted value."));
}
} else if (switchValues.keySet().contains(param))
{
if (!switchValues.get(param).contains(newValue))
{
// todo: error
errors.add(new FieldError(param, "'" + newValue + "' is not a permitted value, must be 0 or 1."));
}
}
}
preProcessed.put(param, newValue);
}
return preProcessed;
}
public void validateParameters(Map<String, String> parameters) {
Set<String> missingRequired = validateRequiredParameters(parameters);
for (String missing : missingRequired)
{
errors.add(new FieldError(missing, "Parameter is required."));
}
for (String param : parameters.keySet())
{
if (!allowedParameters.contains(param))
{
errors.add(new FieldError(param, "Does not exist."));
continue;
}
String error = validate(param, parameters.get(param));
if (error != null)
{
errors.add(new FieldError(param, error));
}
}
}
public void validateInput(Set<String> input) {
Set<String> missingRequired = validateRequiredInput(input);
for (String missing : missingRequired)
{
errors.add(new FieldError(missing, "Input file parameter is required."));
}
}
String validate(String parameter, Object value) {
if (parameter.equals("table_")) {
if (BaseValidator.validateString(value) == false)
return "Parameter is required.";
return null;
}
if (parameter.equals("orfminsize_")) {
if (BaseValidator.validateInteger(value) == false)
return "Must be an integer.";
if (BaseValidator.validateIntegerMinValue(value, 1) == false)
return "Must be an integer greater than " + "or equal to 1";
return null;
}
if (parameter.equals("width_")) {
if (BaseValidator.validateInteger(value) == false)
return "Must be an integer.";
if (BaseValidator.validateIntegerMinValue(value, 1) == false)
return "Must be an integer greater than " + "or equal to 1";
return null;
}
if (parameter.equals("length_")) {
if (BaseValidator.validateInteger(value) == false)
return "Must be an integer.";
return null;
}
if (parameter.equals("margin_")) {
if (BaseValidator.validateInteger(value) == false)
return "Must be an integer.";
return null;
}
if (parameter.equals("offset_")) {
if (BaseValidator.validateInteger(value) == false)
return "Must be an integer.";
return null;
}
return null;
}
private Set<String> validateRequiredParameters(Map<String, String> parameters) {
Set<String> required = new HashSet<String>(requiredParameters.size());
required.addAll(requiredParameters);
for (String parameter : parameters.keySet()) {
if (required.contains(parameter))
required.remove(parameter);
}
return required;
}
private Set<String> validateRequiredInput(Map<String, List<TaskInputSourceDocument>> input) {
Set<String> required = new HashSet<String>(requiredInput.size());
required.addAll(requiredInput);
for (String parameter : input.keySet()) {
if (required.contains(parameter))
required.remove(parameter);
}
return required;
}
private Set<String> validateRequiredInput(Set<String> input) {
Set<String> required = new HashSet<String>(requiredInput.size());
required.addAll(requiredInput);
for (String parameter : input) {
if (required.contains(parameter))
required.remove(parameter);
}
return required;
}
}


text:
set -o errexit
set -o nounset
set -o pipefail

pushd "../../../.."
source "./hack/lib/util.sh"
source "./hack/lib/logging.sh"
source "./hack/lib/etcd.sh"
popd

cleanup() {
  kube::etcd::cleanup
  kube::log::status "performance test cleanup complete"
}

trap cleanup EXIT

kube::etcd::start
kube::log::status "performance test start"

# TODO: set log-dir and prof output dir.
DIR_BASENAME=$(basename `pwd`)
go test -c -o "${DIR_BASENAME}.test"
# We are using the benchmark suite to do profiling. Because it only runs a few pods and
# theoretically it has less variance.
"./${DIR_BASENAME}.test" -test.bench=. -test.run=xxxx -test.cpuprofile=prof.out -logtostderr=false
kube::log::status "benchmark tests finished"
# Running density tests. It might take a long time.
"./${DIR_BASENAME}.test" -test.run=. -test.timeout=60m
kube::log::status "density tests finished"


text:
package com.funtl.leesite.modules.cases.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolationException;

import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.google.common.collect.Lists;
import com.funtl.leesite.common.utils.DateUtils;
import com.funtl.leesite.common.utils.MyBeanUtils;
import com.funtl.leesite.common.config.Global;
import com.funtl.leesite.common.persistence.Page;
import com.funtl.leesite.common.web.BaseController;
import com.funtl.leesite.common.utils.StringUtils;
import com.funtl.leesite.common.utils.excel.ExportExcel;
import com.funtl.leesite.common.utils.excel.ImportExcel;
import com.funtl.leesite.modules.cases.entity.CaseSingleTable;
import com.funtl.leesite.modules.cases.service.CaseSingleTableService;

/**
 * 生成示例Controller
 * @author Lusifer
 * @version 2017-05-05
 */
@Controller
@RequestMapping(value = "${adminPath}/cases/caseSingleTable")
public class CaseSingleTableController extends BaseController {

	@Autowired
	private CaseSingleTableService caseSingleTableService;

	@ModelAttribute
	public CaseSingleTable get(@RequestParam(required=false) String id) {
		CaseSingleTable entity = null;
		if (StringUtils.isNotBlank(id)){
			entity = caseSingleTableService.get(id);
		}
		if (entity == null){
			entity = new CaseSingleTable();
		}
		return entity;
	}

	/**
	 * 单表列表页面
	 */
	@RequiresPermissions("cases:caseSingleTable:list")
	@RequestMapping(value = {"list", ""})
	public String list(CaseSingleTable caseSingleTable, HttpServletRequest request, HttpServletResponse response, Model model) {
		Page<CaseSingleTable> page = caseSingleTableService.findPage(new Page<CaseSingleTable>(request, response), caseSingleTable);
		model.addAttribute("page", page);
		return "modules/cases/caseSingleTableList";
	}

	/**
	 * 查看,增加,编辑单表表单页面
	 */
	@RequiresPermissions(value={"cases:caseSingleTable:view","cases:caseSingleTable:add","cases:caseSingleTable:edit"},logical=Logical.OR)
	@RequestMapping(value = "form")
	public String form(CaseSingleTable caseSingleTable, Model model) {
		model.addAttribute("caseSingleTable", caseSingleTable);
		return "modules/cases/caseSingleTableForm";
	}

	/**
	 * 保存单表
	 */
	@RequiresPermissions(value={"cases:caseSingleTable:add","cases:caseSingleTable:edit"},logical=Logical.OR)
	@RequestMapping(value = "save")
	public String save(CaseSingleTable caseSingleTable, Model model, RedirectAttributes redirectAttributes) throws Exception{
		if (!beanValidator(model, caseSingleTable)){
			return form(caseSingleTable, model);
		}
		if(!caseSingleTable.getIsNewRecord()){//编辑表单保存
			CaseSingleTable t = caseSingleTableService.get(caseSingleTable.getId());//从数据库取出记录的值
			MyBeanUtils.copyBeanNotNull2Bean(caseSingleTable, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
			caseSingleTableService.save(t);//保存
		}else{//新增表单保存
			caseSingleTableService.save(caseSingleTable);//保存
		}
		addMessage(redirectAttributes, "保存单表成功");
		return "redirect:"+Global.getAdminPath()+"/cases/caseSingleTable";
	}

	/**
	 * 删除单表
	 */
	@RequiresPermissions("cases:caseSingleTable:del")
	@RequestMapping(value = "delete")
	public String delete(CaseSingleTable caseSingleTable, RedirectAttributes redirectAttributes) {
		caseSingleTableService.delete(caseSingleTable);
		addMessage(redirectAttributes, "删除单表成功");
		return "redirect:"+Global.getAdminPath()+"/cases/caseSingleTable";
	}

	/**
	 * 批量删除单表
	 */
	@RequiresPermissions("cases:caseSingleTable:del")
	@RequestMapping(value = "deleteAll")
	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
		String idArray[] =ids.split(",");
		for(String id : idArray){
			caseSingleTableService.delete(caseSingleTableService.get(id));
		}
		addMessage(redirectAttributes, "删除单表成功");
		return "redirect:"+Global.getAdminPath()+"/cases/caseSingleTable";
	}

	/**
	 * 导出excel文件
	 */
	@RequiresPermissions("cases:caseSingleTable:export")
    @RequestMapping(value = "export", method=RequestMethod.POST)
    public String exportFile(CaseSingleTable caseSingleTable, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
		try {
            String fileName = "单表"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
            Page<CaseSingleTable> page = caseSingleTableService.findPage(new Page<CaseSingleTable>(request, response, -1), caseSingleTable);
    		new ExportExcel("单表", CaseSingleTable.class).setDataList(page.getList()).write(response, fileName).dispose();
    		return null;
		} catch (Exception e) {
			addMessage(redirectAttributes, "导出单表记录失败!失败信息:"+e.getMessage());
		}
		return "redirect:"+Global.getAdminPath()+"/cases/caseSingleTable";
    }

	/**
	 * 导入Excel数据
	 */
	@RequiresPermissions("cases:caseSingleTable:import")
    @RequestMapping(value = "import", method=RequestMethod.POST)
    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
		try {
			int successNum = 0;
			int failureNum = 0;
			StringBuilder failureMsg = new StringBuilder();
			ImportExcel ei = new ImportExcel(file, 1, 0);
			List<CaseSingleTable> list = ei.getDataList(CaseSingleTable.class);
			for (CaseSingleTable caseSingleTable : list){
				try{
					caseSingleTableService.save(caseSingleTable);
					successNum++;
				}catch(ConstraintViolationException ex){
					failureNum++;
				}catch (Exception ex) {
					failureNum++;
				}
			}
			if (failureNum>0){
				failureMsg.insert(0, ",失败 "+failureNum+" 条单表记录。");
			}
			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条单表记录"+failureMsg);
		} catch (Exception e) {
			addMessage(redirectAttributes, "导入单表失败!失败信息:"+e.getMessage());
		}
		return "redirect:"+Global.getAdminPath()+"/cases/caseSingleTable";
    }

	/**
	 * 下载导入单表数据模板
	 */
	@RequiresPermissions("cases:caseSingleTable:import")
    @RequestMapping(value = "import/template")
    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
		try {
            String fileName = "单表数据导入模板.xlsx";
    		List<CaseSingleTable> list = Lists.newArrayList();
    		new ExportExcel("单表数据", CaseSingleTable.class, 1).setDataList(list).write(response, fileName).dispose();
    		return null;
		} catch (Exception e) {
			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
		}
		return "redirect:"+Global.getAdminPath()+"/cases/caseSingleTable";
    }

}