text:
#import "CPTPlotSpaceAnnotation.h"

#import "CPTPlotArea.h"
#import "CPTPlotAreaFrame.h"
#import "CPTPlotSpace.h"

/// @cond

@interface CPTPlotSpaceAnnotation()

-(void)setContentNeedsLayout;

@end

/// @endcond

#pragma mark -

/** @brief Positions a content layer relative to some anchor point in a plot space.
 *
 *  Plot space annotations are positioned relative to a plot space. This allows the
 *  annotation content layer to move with the plot when the plot space changes.
 *  This is useful for applications such as labels attached to specific data points on a plot.
 **/
@implementation CPTPlotSpaceAnnotation

/** @property NSArray *anchorPlotPoint
 *  @brief An array of NSDecimalNumber objects giving the anchor plot coordinates.
 **/
@synthesize anchorPlotPoint;

/** @property CPTPlotSpace *plotSpace
 *  @brief The plot space which the anchor is defined in.
 **/
@synthesize plotSpace;

#pragma mark -
#pragma mark Init/Dealloc

/// @name Initialization
/// @{

/** @brief Initializes a newly allocated CPTPlotSpaceAnnotation object.
 *
 *  This is the designated initializer. The initialized layer will be anchored to
 *  a point in plot coordinates.
 *
 *  @param newPlotSpace The plot space which the anchor is defined in. Must be non-@nil.
 *  @param newPlotPoint An array of NSDecimalNumber objects giving the anchor plot coordinates.
 *  @return The initialized CPTPlotSpaceAnnotation object.
 **/
-(id)initWithPlotSpace:(CPTPlotSpace *)newPlotSpace anchorPlotPoint:(NSArray *)newPlotPoint
{
    NSParameterAssert(newPlotSpace);

    if ( (self = [super init]) ) {
        plotSpace       = newPlotSpace ;
        anchorPlotPoint = [newPlotPoint copy];

        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(setContentNeedsLayout)
                                                     name:CPTPlotSpaceCoordinateMappingDidChangeNotification
                                                   object:plotSpace];
    }
    return self;
}

/// @}

/// @cond

// plotSpace is required; this will fail the assertion in -initWithPlotSpace:anchorPlotPoint:
-(id)init
{
    return [self initWithPlotSpace:nil anchorPlotPoint:nil];
}

-(void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self];

}

/// @endcond

#pragma mark -
#pragma mark NSCoding Methods

/// @cond

-(void)encodeWithCoder:(NSCoder *)coder
{
    [super encodeWithCoder:coder];

    [coder encodeObject:self.anchorPlotPoint forKey:@"CPTPlotSpaceAnnotation.anchorPlotPoint"];
    [coder encodeConditionalObject:self.plotSpace forKey:@"CPTPlotSpaceAnnotation.plotSpace"];
}

-(id)initWithCoder:(NSCoder *)coder
{
    if ( (self = [super initWithCoder:coder]) ) {
        anchorPlotPoint = [[coder decodeObjectForKey:@"CPTPlotSpaceAnnotation.anchorPlotPoint"] copy];
        plotSpace       = [coder decodeObjectForKey:@"CPTPlotSpaceAnnotation.plotSpace"] ;
    }
    return self;
}

/// @endcond

#pragma mark -
#pragma mark Layout

/// @cond

-(void)setContentNeedsLayout
{
    [self.contentLayer.superlayer setNeedsLayout];
}

-(void)positionContentLayer
{
    CPTLayer *content = self.contentLayer;

    if ( content ) {
        CPTLayer *hostLayer = self.annotationHostLayer;
        if ( hostLayer ) {
            NSArray *plotAnchor = self.anchorPlotPoint;
            if ( plotAnchor ) {
                NSUInteger anchorCount = plotAnchor.count;

                // Get plot area point
                NSDecimal *decimalPoint = malloc(sizeof(NSDecimal) * anchorCount);
                for ( NSUInteger i = 0; i < anchorCount; i++ ) {
                    decimalPoint[i] = [[plotAnchor objectAtIndex:i] decimalValue];
                }
                CPTPlotSpace *thePlotSpace      = self.plotSpace;
                CGPoint plotAreaViewAnchorPoint = [thePlotSpace plotAreaViewPointForPlotPoint:decimalPoint numberOfCoordinates:anchorCount];
                free(decimalPoint);

                CGPoint newPosition;
                CPTPlotArea *plotArea = thePlotSpace.graph.plotAreaFrame.plotArea;
                if ( plotArea ) {
                    newPosition = [plotArea convertPoint:plotAreaViewAnchorPoint toLayer:hostLayer];
                }
                else {
                    newPosition = CGPointZero;
                }
                CGPoint offset = self.displacement;
                newPosition.x += offset.x;
                newPosition.y += offset.y;

                content.anchorPoint = self.contentAnchorPoint;
                content.position    = newPosition;
                content.transform   = CATransform3DMakeRotation( self.rotation, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0) );
                [content pixelAlign];
            }
        }
    }
}

/// @endcond

#pragma mark -
#pragma mark Accessors

/// @cond

-(void)setAnchorPlotPoint:(NSArray *)newPlotPoint
{
    if ( anchorPlotPoint != newPlotPoint ) {

        anchorPlotPoint = [newPlotPoint copy];
        [self setContentNeedsLayout];
    }
}

/// @endcond

@end


text:
/**
 *
 * Man könnte überlegen den Extensions ein Sandbox-Element zu geben, welches diese auch erweitern
 * können. z.B. könnte damit die Hooks-extension die Sandbox erweitern, ohne dass diese von modulen
 * erreichbar wären.
 *
 * Noch eine Überschrift
 * =====================
 * Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt
 * ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo
 * dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor
 * sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
 * invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et
 *
 *     if(!!core[id]) {
 *       core.logger.log("Info: Overwriting '"+id+"'. It is already defined.");
 *     }
 *
 *
 * Justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum
 * dolor sit amet.
 *
 * Testüberschrift
 * ---------------
 * Dies ist nur ein Absatz in **Markdown**, um zu testen, ob dies funnktioniert.
 *
 * Core contains a simple {Core.logger logger} which only supports one functionality {.log}.
 *
 * @todo Extensions als Packages: Core.extend('foo.bar') => Core.foo.bar mit foo = foo|| {}
 * @todo Dependency Check der Extensions
 * @todo Extensionloader
 *
 * @note something to note, which is really important, because im testing the style of `@note-tokens`
 *       var foo = {
 *         bar: 4
 *       }
 *
 * @deprecated since 1.0 - because this is not as cool, as i suspected first.
 *
 * @warn don't use without parental advise
 *
 * @author Jonathan Brachthäuser
 * @version 1.2.245
 *
 * @example foobar
 *   This is just a stupid test
 *
 * @object Core
 */
var Core = Core || (function(){

  var _extensions = {};

  var core = {

    /**
     * @function Core.extend
     *
     * register new {Core.extensions}
     *
     * @example Testextension
     *   // This is some http://www.link.com
     *   Core.extend('testextension', function() {
     *     return {};
     *   });
     *
     * @event CoreExtended
     *   Fires, if a new Extension has been registered.
     *   [Core.extension] ext The newly registered extension
     *
     * @param [String] id the id to register the new {Core.extensionss extension} under
     * @param [Function] constructor a callback function, which acts as
     *   constructor for {Core.extensions}
     * @param settings
     *   This is the configuration object for {Core.extend}
     *   [String] name the name of the extension
     *   [Number] pos the position to put the extension to (Defaults to 0)
     *   [String] color the background-color of the extension
     *
     * @return [Core.logger] the constructed extension
     */
    extend: function(id, constructor) {

      // Already defined
      if(!!core[id]) {
        core.logger.log("Info: Overwriting '"+id+"'. It is already defined.");
      }

      var ext = constructor();
      if(!!ext) {
        core[id] = ext;
        _extensions[id] = ext;
      } else {
        core.logger.log("Info: Constructor of '"+id+"' did not return a valid value.");
      }
    },

    /**
     * List all registered {Core.extensions extensions}
     *
     * @function Core.extensions
     *
     * @return [Array] all registered extensions
     */
    extensions: function() {
      return _extensions;
    },

    /**
     * Adds minimal logging functionality to {Core}
     *
     * @object Core.logger
     */
    logger: {

      /**
       * Logs a message if the console is present
       *
       * @function Core.logger.log
       *
       * @overload
       *   @param [String] msg The message to log
       *
       * @overload
       *   This is just some documentation
       *
       *   @param [String] level The Loglevel
       *   @param [String] msg The message to log
       */
      log: function(msg) {
        if(!!window.console) {
          window.console.log(msg);
        }
      }
    },

    /**
     * Config Object for Core
     * @object Core.properties
     *
     * @prop [Boolean] logging turns internal logging on and off
     * @prop [Numeric] maximalExtensions limits the maximum extensions count
     * @prop [Boolean] autostart should Core start on Application-start?
     */
    properties: {
      logging: true,
      maximalExtensions: 4,
      autostart: true
    }
  };

  return core;
})();

redpajama_set_name: RedPajamaGithub


text:
'use strict';

function test_emptyWorkspace() {
  var workspace = new Blockly.Workspace();
  assertEquals('Empty workspace (1).', 0, workspace.getTopBlocks(true).length);
  assertEquals('Empty workspace (2).', 0, workspace.getTopBlocks(false).length);
  assertEquals('Empty workspace (3).', 0, workspace.getAllBlocks().length);
  workspace.clear();
  assertEquals('Empty workspace (4).', 0, workspace.getTopBlocks(true).length);
  assertEquals('Empty workspace (5).', 0, workspace.getTopBlocks(false).length);
  assertEquals('Empty workspace (6).', 0, workspace.getAllBlocks().length);
}

function test_flatWorkspace() {
  var workspace = new Blockly.Workspace();
  var blockA = workspace.newBlock('');
  assertEquals('One block workspace (1).', 1, workspace.getTopBlocks(true).length);
  assertEquals('One block workspace (2).', 1, workspace.getTopBlocks(false).length);
  assertEquals('One block workspace (3).', 1, workspace.getAllBlocks().length);
  var blockB = workspace.newBlock('');
  assertEquals('Two block workspace (1).', 2, workspace.getTopBlocks(true).length);
  assertEquals('Two block workspace (2).', 2, workspace.getTopBlocks(false).length);
  assertEquals('Two block workspace (3).', 2, workspace.getAllBlocks().length);
  blockA.dispose();
  assertEquals('One block workspace (4).', 1, workspace.getTopBlocks(true).length);
  assertEquals('One block workspace (5).', 1, workspace.getTopBlocks(false).length);
  assertEquals('One block workspace (6).', 1, workspace.getAllBlocks().length);
  workspace.clear();
  assertEquals('Cleared workspace (1).', 0, workspace.getTopBlocks(true).length);
  assertEquals('Cleared workspace (2).', 0, workspace.getTopBlocks(false).length);
  assertEquals('Cleared workspace (3).', 0, workspace.getAllBlocks().length);
}

function test_maxBlocksWorkspace() {
  var workspace = new Blockly.Workspace();
  var blockA = workspace.newBlock('');
  var blockB = workspace.newBlock('');
  assertEquals('Infinite capacity.', Infinity, workspace.remainingCapacity());
  workspace.options.maxBlocks = 3;
  assertEquals('Three capacity.', 1, workspace.remainingCapacity());
  workspace.options.maxBlocks = 2;
  assertEquals('Two capacity.', 0, workspace.remainingCapacity());
  workspace.options.maxBlocks = 1;
  assertEquals('One capacity.', -1, workspace.remainingCapacity());
  workspace.options.maxBlocks = 0;
  assertEquals('Zero capacity.', -2, workspace.remainingCapacity());
  workspace.clear();
  assertEquals('Cleared capacity.', 0, workspace.remainingCapacity());
}

function test_getWorkspaceById() {
  var workspaceA = new Blockly.Workspace();
  var workspaceB = new Blockly.Workspace();
  assertEquals('Find workspaceA.', workspaceA,
      Blockly.Workspace.getById(workspaceA.id));
  assertEquals('Find workspaceB.', workspaceB,
      Blockly.Workspace.getById(workspaceB.id));
  assertEquals('No workspace found.', null,
      Blockly.Workspace.getById('I do not exist.'));
  workspaceA.dispose();
  assertEquals('Can\'t find workspaceA.', null,
      Blockly.Workspace.getById(workspaceA.id));
  assertEquals('WorkspaceB exists.', workspaceB,
      Blockly.Workspace.getById(workspaceB.id));
}

function test_getBlockById() {
  var workspace = new Blockly.Workspace();
  var blockA = workspace.newBlock('');
  var blockB = workspace.newBlock('');
  assertEquals('Find blockA.', blockA, workspace.getBlockById(blockA.id));
  assertEquals('Find blockB.', blockB, workspace.getBlockById(blockB.id));
  assertEquals('No block found.', null,
      workspace.getBlockById('I do not exist.'));
  blockA.dispose();
  assertEquals('Can\'t find blockA.', null, workspace.getBlockById(blockA.id));
  assertEquals('BlockB exists.', blockB, workspace.getBlockById(blockB.id));
  workspace.clear();
  assertEquals('Can\'t find blockB.', null, workspace.getBlockById(blockB.id));
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

	<title>{#imgInsert_dlg.title}</title>

{#imgInsert_dlg.title}

{#imgInsert_dlg.title}:

  	<form action="upload.php" method="post" id="formdd">
    	<input type="file" width="30px" />

				<input type="submit" id="insert" name="insert" value="{#insert}" />
				<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />

    </form>


text:
/*global Hammer*/
import Ember from 'ember';
import camelize from 'ember-allpurpose/string/dasherized-to-camel';
import capitalize from 'ember-allpurpose/string/capitalize-word';

const {
  Service,
  set: set,
  RSVP
  } = Ember;

const {
  Promise
  } = RSVP;

export default Service.extend({

  _recognizers: null,

  retrieve(names) {
    let promises = names.map((name) => { return this.lookupRecognizer(name); });
    return RSVP.all(promises);
  },

  makeRecognizer(name, details) {

    let eventName = details.includeEvents ? camelize(name).toLowerCase() : details.recognizer;
    let gesture = capitalize(details.recognizer);

    let options = details.options || {};
    options.event = eventName;

    let Recognizer = new Hammer[gesture](options);

    if (details.include) {
      let included = details.include.map((name) => {
        return this.lookupRecognizer(name);
      });

      RSVP.all(included).then((recognizers) => {
        Recognizer.recognizeWith(recognizers);
      });

    }

    if (details.exclude) {
      let excluded = details.exclude.map((name) => {
        return this.lookupRecognizer(name);
      });

      RSVP.all(excluded).then((recognizers) => {
        Recognizer.requireFailure(recognizers);
      });

    }

    this.registerRecognizer(name, Recognizer);
    return Recognizer;

  },

  lookupRecognizer(name) {
    return new Promise((resolve, reject) => {
      let recognizer = this.get(`_recognizers.${name}`);
      if (recognizer) {
        resolve(recognizer);
        return;
      }

      let path = `ember-gesture:recognizers/${name}`;
      let details = this.container.lookupFactory(path);
      if (details) {
        resolve(this.makeRecognizer(name, details));
        return;
      }

      reject(`ember-gestures/recognizers/${name} was not found. You can scaffold this recognizer with 'ember g recognizer ${name}'`);

    });
  },

  registerRecognizer(name, Recognizer) {
    let registry = this.get('_recognizers');
    set(registry, name, Recognizer);
  },

  init() {
    this._super();
    this.set('_recognizers', {});
  }

});


text:
using content::BrowserThread;

namespace {
const char kGoogleDomainUrl[] = "http://.google.com/";
const char kGoogleDomainSecureCookieId[] = "SID=";
const char kSplitStringToken = ';';
}

namespace toolbar_importer_utils {

void OnGetCookies(const base::Callback<void(bool)>& callback,
                  const std::string& cookies) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
  std::vector<std::string> cookie_list;
  base::SplitString(cookies, kSplitStringToken, &cookie_list);
  for (std::vector<std::string>::iterator current = cookie_list.begin();
       current != cookie_list.end();
       ++current) {
    size_t position = (*current).find(kGoogleDomainSecureCookieId);
    if (position == 0) {
      callback.Run(true);
      return;
    }
  }
  callback.Run(false);
}

void OnFetchComplete(const base::Callback<void(bool)>& callback,
                     const std::string& cookies) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
  BrowserThread::PostTask(
      BrowserThread::UI, FROM_HERE,
      base::Bind(&OnGetCookies, callback, cookies));
}

void FetchCookiesOnIOThread(
    const base::Callback<void(bool)>& callback,
    net::URLRequestContextGetter* context_getter) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
  net::CookieStore* store = context_getter->
      GetURLRequestContext()->cookie_store();
  GURL url(kGoogleDomainUrl);
  net::CookieOptions options;
  options.set_include_httponly();  // The SID cookie might be httponly.
  store->GetCookiesWithOptionsAsync(
      url, options,
      base::Bind(&toolbar_importer_utils::OnFetchComplete, callback));
}

void IsGoogleGAIACookieInstalled(const base::Callback<void(bool)>& callback,
                                 Profile* profile) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
  if (!callback.is_null()) {
    BrowserThread::PostTask(
        BrowserThread::IO, FROM_HERE,
        base::Bind(&FetchCookiesOnIOThread,
                   callback, base::Unretained(profile->GetRequestContext())));
  }
}

}  // namespace toolbar_importer_utils


text:
export default function extractKeys(index, document) {
  const { keys } = index;
  if (keys.length === 1) return document[keys[0]];
  else return keys.map(v => document[v]);
}


text:
using System;
using System.Linq;
using Jal.ChainOfResponsability;

namespace Jal.HttpClient
{
    public class HttpMiddlewareDescriptor : IHttpMiddlewareDescriptor
    {
        private readonly HttpRequest _request;

        public HttpMiddlewareDescriptor(HttpRequest request)
        {
            _request = request;
        }

        public void Add<THttpMiddlewareType>(Action<IHttpContextDescriptor> action = null) where THttpMiddlewareType : IAsyncMiddleware<HttpContext>
        {
            var type = typeof(THttpMiddlewareType);
            var item = _request.MiddlewareTypes.FirstOrDefault(x => x == type);
            if (item == null)
            {
                _request.MiddlewareTypes.Add(type);
                if (action != null)
                {
                    var descriptor = new HttpContextDescriptor(_request);
                    action(descriptor);
                }
            }
        }
    }
}


text:
/*  Dummy comments */
var app = angular.module('myApp', []);
app.controller('appController', function($scope,$http) {
	$scope.currentPage='register';
	$scope.friends=[];
	$scope.form={
		username:'foobar',
		password:'foobar',
		cpassword:'foobar',
		email:'foobar@gmail.com',
		fname:'foo',
		lname:'bar'
	};
	$scope.loginform={
		username:'foobar',
		password:'foobar'
	};
	$scope.userTarget=document.getElementById('hdnUserRegSvc').value;
	$scope.twitterTarget=document.getElementById('hdnTwitterSvc').value;
	$scope.$watch('currentPage',function(old,newval) {
		$scope.token='';
	});
    $scope.login = function (){
	  	$http.post($scope.userTarget+"/api/authenticate",$scope.loginform).success(function(data, status) {
            if(data['success']==true){
            	alert('Login successful, click link to get friends list.');
            	$scope.token=data.token;
            }
            else{
            	alert('username/password incorrect');
            }
        });
	};
	$scope.getFriendsList=function(){
	    $http.get($scope.userTarget+"/api/users?token="+$scope.token).success(function(data, status) {
	            console.log(data);
	            $scope.friends=data;
	            $scope.currentPage='friends';
            });
	};
	$scope.getTweets=function(user){
	   $http.get($scope.twitterTarget+"/simple-service-webapp/api/tweets?name="+user).success(function(data, status) {
		    console.log(data);
	            $scope.tweets=data.tweets;
	            $scope.currentPage='tweets';
            });
	}
	$scope.register = function (){
	  	$http.post($scope.userTarget+"/users", $scope.form).success(function(data, status) {
            if(data['success']==true){
            	alert('Registration successful, please login');
            	$scope.currentPage='login';
            }
            else{
            	alert('Error while registering, please retry')
            }
        });
	};
});


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SmileLogistics.DAL.Entities
{
    public class eVehicleLoad
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public string Code { get; set; }
        public double FullLoad { get; set; }
        public string Description { get; set; }
        public int VehicleTypeID { get; set; }

        public bool IsDeleted { get; set; }
        public eSys_User UpdatedBy { get; set; }
        public DateTime LastestUpdate { get; set; }
        public string sLastestUpdate { get; set; }
        public eVehicleType VehicleType { get; set; }
    }
}


text:
package tests.core.validation;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;

import leap.core.AppContext;
import leap.core.junit.AppTestBase;
import leap.core.validation.ValidationManager;
import leap.core.validation.Validator;
import leap.core.validation.annotations.Email;
import leap.core.validation.annotations.NotEmpty;
import leap.core.validation.annotations.Pattern;
import leap.core.validation.validators.NotNullValidator;
import leap.core.validation.validators.RequiredValidator;
import leap.lang.Locales;

import org.junit.Test;

public class ValidationManagerTest extends AppTestBase {

	protected static ValidationManager manager = AppContext.factory().getBean(ValidationManager.class);

	protected static Map<String, Map<Class<? extends Annotation>, Annotation>> constraints = new HashMap<String, Map<Class<? extends Annotation>,Annotation>>();

	static {
		Field[] fields = ValidationAnnotations.class.getFields();
		for(Field field : fields){
			Map<Class<? extends Annotation>, Annotation> fieldConstraints = new HashMap<Class<? extends Annotation>, Annotation>();
			for(Annotation annotation : field.getAnnotations()){
				fieldConstraints.put(annotation.annotationType(), annotation);
			}
			constraints.put(field.getName(), fieldConstraints);
		}
	}

	@Test
	public void testNotEmptyValidator(){
		NotEmpty notEmpty = new NotEmpty() {
			@Override
			public Class<? extends Annotation> annotationType() {
				return NotEmpty.class;
			}
		};

		testNotEmpty(manager.createValidator(notEmpty, String.class));
	}

	@Test
	public void testNotNullValidator(){
		Validator validator = new NotNullValidator();
		assertNotNull(validator);
		assertFalse(validator.validate(null));
		assertTrue(validator.validate(""));
		assertNotEmpty(manager.getErrorMessage(validator));
		testErrorMessage(validator);
	}

	@Test
	public void testPatternValidator(){
		Pattern pattern = constraint("regexValue",Pattern.class);
		Validator validator = manager.createValidator(pattern, String.class);
		assertNotNull(validator);
		assertNotSame(validator, manager.createValidator(pattern, String.class));
		testErrorMessage(validator);
	}

	@Test
	public void testEmailValidator(){
		Email email = constraint("email",Email.class);
		Validator validator = manager.createValidator(email, String.class);
		assertNotNull(validator);
		testErrorMessage(validator);
	}

	@Test
	public void testRequiredValidator(){
		Validator validator = new RequiredValidator();
		assertNotNull(validator);
		testErrorMessage(validator);
	}

	protected void testNotEmpty(Validator validator){
		assertTrue(validator.validate("x"));
		assertFalse(validator.validate(null));
		assertFalse(validator.validate(""));
		testErrorMessage(validator);
	}

	@SuppressWarnings("unchecked")
    protected static <T extends Annotation> T constraint(String field,Class<T> annotationType){
		Map<Class<? extends Annotation>, Annotation> annotations = constraints.get(field);
		T annotation = null;

		if(null != annotations){
			annotation = (T)annotations.get(annotationType);
		}

		if(annotation == null){
			throw new IllegalStateException("No constraint annotation type '" + annotationType.getName() + "' exists in field '" + field + "'");
		}

		return annotation;
	}

	protected void testErrorMessage(Validator validator){
		assertNotEmpty(manager.getErrorMessage(validator));
		assertNotEmpty(manager.getErrorMessage(validator,"x",Locales.DEFAULT_LOCALE));
	}
}


text:
(function() {
  var Apps, AppsClient,
    __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

  AppsClient = require('./apps-client');

  module.exports = Apps = (function() {
    function Apps(client) {
      this.client = client;
      this.clients = __bind(this.clients, this);
      this.update = __bind(this.update, this);
      this["delete"] = __bind(this["delete"], this);
      this.create = __bind(this.create, this);
      this.get = __bind(this.get, this);
      this.all = __bind(this.all, this);
      if (!this.client) {
        throw new Error("client parameter is required");
      }
    }

    Apps.prototype.all = function(cb) {
      if (cb == null) {
        cb = function() {};
      }
      return this.client.get("/apps", null, cb);
    };

    Apps.prototype.get = function(id, actor, cb) {
      if (cb == null) {
        cb = function() {};
      }
      return this.client.get("/apps/" + id, actor, cb);
    };

    Apps.prototype.create = function(data, actor, cb) {
      if (cb == null) {
        cb = function() {};
      }
      return this.client.post("/apps", data, actor, cb);
    };

    Apps.prototype["delete"] = function(id, actor, cb) {
      if (cb == null) {
        cb = function() {};
      }
      return this.client["delete"]("/apps/" + id, actor, cb);
    };

    Apps.prototype.update = function(id, data, actor, cb) {
      if (cb == null) {
        cb = function() {};
      }
      return this.client.patch("/apps/" + id, data, actor, cb);
    };

    Apps.prototype.clients = function(appId) {
      return new AppsClient(this.client, appId);
    };

    return Apps;

  })();

}).call(this);


text:
module RailsAdminGoogleanalytics
  class Engine < ::Rails::Engine
  end
end


text:
package org.mybatis.dao.selecte;

import org.mybatis.dao.Condation;
import org.mybatis.dao.DaoConfig;
import org.mybatis.dao.DaoContext;
import org.mybatis.dao.mapper.DaoMapper;

/**
 * @author 作者 :吴立中
 * @version 1.0
 * @date	创建时间:2016年7月19日 下午5:11:52
 *
 */
public class SelectContext extends DaoContext{

	private Class<?> type;

	public SelectContext(Class<?> type, DaoConfig daoConfig, DaoMapper daoMapper, Condation condation) {
		super(daoConfig, daoMapper, condation);
		// TODO Auto-generated constructor stub
		this.type = type;
	}

//	private Page page;
//
//	public Page getPage() {
//		return page;
//	}
//
//	public void setPage(Page page) {
//		this.page = page;
//	}

	public Class<?> getType() {
		return type;
	}

	public void setType(Class<?> type) {
		this.type = type;
	}

}


text:
The AWS IAM Plugin integrates RightScale Self-Service with the basic functionality of the AWS Identify and Access Management API.

## Requirements

- A general understanding CAT development and definitions
  - Refer to the guide documentation for details [SS Guides](http://docs.rightscale.com/ss/guides/)
- The `admin`, `ss_designer` & `ss_end_user` roles, in a RightScale account with SelfService enabled.  `admin` is needed to retrieved the RightScale Credential values identified below.
- AWS Account credentials with the appropriate permissions to manage elastic load balancers
- The following RightScale Credentials
  - `AWS_ACCESS_KEY_ID`
  - `AWS_SECRET_ACCESS_KEY`
- The following packages are also required (See the Installation section for details):
  - [sys_log](../../libraries/sys_log.rb)
  - [plugin_generics](../../libraries/plugin_generics.rb)

## Installation

1. Be sure your RightScale account has Self-Service enabled
1. Connect AWS Cloud credentials to your RightScale account (if not already completed)
1. Navigate to the appropriate Self-Service portal
   - For more details on using the portal review the [SS User Interface Guide](http://docs.rightscale.com/ss/guides/ss_user_interface_guide.html)
1. In the Design section, use the `Upload CAT` interface to complete the following:
   1. Upload each of packages listed in the Requirements Section
   1. Upload the `aws_iam_plugin.rb` file located in this repository

## How to Use

The IAM Plugin has been packaged as `plugin/rs_aws_iam`. In order to use this plugin you must import this plugin into a CAT.

```ruby

import "plugin/rs_aws_iam"
```

For more information on using packages, please refer to the RightScale online documentation. [Importing a Package](http://docs.rightscale.com/ss/guides/ss_packaging_cats.html#importing-a-package)

## Supported Resources

- role
- policy
- instance_profile

## Resource: `role`

### Supported Fields

**Note:** There are many possible configurations when defining a `role` resource.  While some fields below are not listed as "Required", they may actually be required for your resource,  depending on the value(s) of other field(s). More detailed field documentation is available in-line within the IAM Plugin.

| Field Name | Required? | Description |
|------------|-----------|-------------|
| name | yes | The name of the role to create. |
| assume_role_policy_document | yes |  The trust relationship policy document that grants an entity permission to assume the role. |
| description | no | A description of the role. |
| availability_zone | no | The EC2 Availability Zone that the database instance will be created in. |
| max_session_duration | no | The maximum session duration (in seconds) that you want to set for the specified role. If you do not specify a value for this setting, the default maximum of one hour is applied. This setting can have a value from 1 hour to 12 hours. |
| path | no | The path to the role. |
| policies | no | Attaches the specified managed policy to the specified IAM role. When you attach a managed policy to a role, the managed policy becomes part of the role's permission (access) policy. |

#### Supported Outputs

- RoleName

#### Usage

AWS IAM resources can now be created by specifying a resource declaration with the desired fields. See the Supported Actions section for a full list of supported actions.
The resulting resource can be manipulated just like the native RightScale resources in RCL and CAT. See the Examples Section for more examples and complete CAT's.

```ruby

resource "my_role", type: "rs_aws_iam.role" do
  name 'MyTestRole'
  assume_role_policy_document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":["ec2.amazonaws.com"]},"Action":["sts:AssumeRole"]}]}'
  description "test role description"
  policies @my_policy.Arn, @my_policy2.Arn
end
```

#### Supported Actions

| Action | API Implementation | Support Level |
|--------------|:----:|:-------------:|
| create | [CreateRole](https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreateRole.html) | Supported |
| destroy | [DeleteRole](https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteRole.html) | Supported |
| get | [GetRole](https://docs.aws.amazon.com/IAM/latest/APIReference/API_GetRole.html) | Supported |
| attach_policy | [AttachRolePolicy](https://docs.aws.amazon.com/IAM/latest/APIReference/API_AttachRolePolicy.html) | Supported |
| detach_policy | [DetachRolePolicy](https://docs.aws.amazon.com/IAM/latest/APIReference/API_DetachRolePolicy.html) | Supported |
| attached_policies | [ListAttachedRolePolicies](https://docs.aws.amazon.com/IAM/latest/APIReference/API_ListAttachedRolePolicies.html) | Supported |

## Resource: `policy`

### Supported Fields

| Field Name | Required? | Description |
|------------|-----------|-------------|
| name | yes |  The friendly name of the policy. |
| description | no | A friendly description of the policy.|
| policy_document | yes | The JSON policy document that you want to use as the content for the new policy.|
| path | no | The path for the policy. |

### Supported Outputs

- PolicyName
- Arn
- PolicyArn

#### Usage

```ruby

#Creates a new IAM Policy
resource "my_policy", type: "rs_aws_iam.policy" do
  name "MyTestPolicy"
  policy_document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"s3:ListAllMyBuckets",
"Resource":"arn:aws:s3:::*"},{"Effect":"Allow","Action":["s3:Get*","s3:List*"],"Resource":
["arn:aws:s3:::EXAMPLE-BUCKET","arn:aws:s3:::EXAMPLE-BUCKET/*"]}]}'
  description "test policy description"
end
```

#### Supported Actions

| Action | API Implementation | Support Level |
|--------------|:----:|:-------------:|
| create | [CreatePolicy](https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreatePolicy.html) | Supported |
| destroy | [DeletePolicy](https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeletePolicy.html) | Supported |
| get | [GetPolicy](https://docs.aws.amazon.com/IAM/latest/APIReference/API_GetPolicy.html) | Supported |

## Resource: `instance_profile`

### Supported Fields

| Field Name | Required? | Description |
|------------|-----------|-------------|
| name | yes |  The friendly name of the policy. |
| description | no | A friendly description of the policy.|
| policy_document | yes | The JSON policy document that you want to use as the content for the new policy.|
| path | no | The path for the policy. |

### Supported Outputs

- PolicyName
- Arn
- PolicyArn

#### Usage

```ruby

#Creates a new IAM Instance Profile
resource "my_instance_profile", type:"rs_aws_iam.instance_profile" do
  name "MyInstanceProfile"
  role_name @my_role.RoleName
end
```

#### Supported Actions

| Action | API Implementation | Support Level |
|--------------|:----:|:-------------:|
| create | [CreatePolicy](https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreateInstanceProfile.html) | Supported |
| destroy | [DeletePolicy](https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteInstanceProfile.html) | Supported |
| get | [GetPolicy](https://docs.aws.amazon.com/IAM/latest/APIReference/API_GetInstanceProfile.html) | Supported |
| add_role| [AddRoleToInstanceProfile](https://docs.aws.amazon.com/IAM/latest/APIReference/API_AddRoleToInstanceProfile.html) | Supported |

## Examples

Please review [iam_test_cat.rb](./iam_test_cat.rb) for a basic example implementation.

## Known Issues / Limitations

- Currently only supports a few actions from the IAM functions.

## License

The AWS IAM Plugin source code is subject to the MIT license, see the [LICENSE](../../LICENSE) file.


text:
package org.apache.pig.backend.datastorage;

public interface ContainerDescriptor
                 extends ElementDescriptor,
                 Iterable<ElementDescriptor> {
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO.Ports;
using System.Diagnostics;
using System.ComponentModel;
using System.Threading;
using System.Globalization;

namespace RN4020_DataLogger
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        RN4020 rn4020 = new RN4020();

        bool isScanning = false;

        bool isLogging = false;

        bool isUpdating = false;

        int currentDataObjectIndex = 0;

        Charger currentCharger;

        List<Charger> ChargerList = new List<Charger>();

        System.Windows.Threading.DispatcherTimer logTimer = new System.Windows.Threading.DispatcherTimer();

        public MainWindow()
        {
            InitializeComponent();

            // create the handle list
            Charger obj = new Charger();
            obj.Name = "Charger1";
            obj.Address = "001EC01A6643";
            obj.init();
            obj.ServiceDate.Textbox = textBoxDate;
            obj.ServiceDeviceID.Textbox = textBoxDeviceID;
            obj.ServiceChargingPower.Textbox = textBoxChargingCurrent;
            obj.ServiceStartTime.Textbox = textBoxChargingStart;
            obj.ServiceEndTime.Textbox = textBoxEndTime;
            obj.ServiceTotalCharge.Textbox = textBoxTotalCurrent;
            obj.ServicePowerUpVoltage.Textbox = textBoxPowerUpVoltage;
            obj.ServicePowerDownVoltage.Textbox = textBoxPowerDownVoltage;
            obj.ServiceActive.Textbox = textBoxActive;

            ChargerList.Add(obj);

            logTimer.Tick += new EventHandler(logTimer_Tick);
            logTimer.Interval = new TimeSpan(0, 0, 0, 0, 200);

            currentCharger = obj;

            // get a list of the available serial ports
            string[] ports = SerialPort.GetPortNames();
            // update the serial port combo box

            if (ports.Length > 0)
            {
                foreach (string port in ports)
                {
                    ComboboxItem item = new ComboboxItem();
                    item.Text = port;
                    item.Value = port;
                    cbComPortList.Items.Add(item);
                }

                // set the combo box selected item to be the first com port
                cbComPortList.SelectedIndex = 0;

                // add a click event listener to the devices list box
                listviewDevices.SelectionChanged += listviewDevices_SelectionChanged;

                rn4020.ClientServicesList.ListChanged += ClientServicesList_ListChanged;

                rn4020.ClientServicesUpdated += Rn4020_ClientServicesUpdated;

            }

        }

        private void logTimer_Tick(object sender, EventArgs e)
        {
            logTimer.Stop();
            string handle = currentCharger.Services[currentDataObjectIndex].Handle;
            rn4020.GetClientServiceValue(handle);
        }

        private void Rn4020_ClientServicesUpdated(object sender, EventArgs e)
        {
            string value = rn4020.currentHandleValue;
            string returnString = "";

            if (currentCharger.Services[currentDataObjectIndex].DataType == typeof(Double))
            {
                double dbval = Double.Parse(value);
                dbval = dbval / 1000;
                returnString = dbval.ToString();
                currentCharger.Services[currentDataObjectIndex].Value = dbval;
            }

            if (currentCharger.Services[currentDataObjectIndex].DataType == typeof(DateTime))
            {
                DateTime date = ConvertDate(value, "yyMMddHHmmss");
                currentCharger.Services[currentDataObjectIndex].Value = date;
                returnString = date.ToString();

                //returnString = value;
            }

            if (currentCharger.Services[currentDataObjectIndex].DataType == typeof(String))
            {
                returnString = value;
                currentCharger.Services[currentDataObjectIndex].Value = returnString;
            }

            if (currentCharger.Services[currentDataObjectIndex].DataType == typeof(Boolean))
            {
                Boolean boolvalue = true;
                if (value.Contains('1'))
                {
                    boolvalue = true;
                    returnString = "True";
                }
                else
                {
                    boolvalue = false;
                    returnString = "False";
                }

                currentCharger.Services[currentDataObjectIndex].Value = boolvalue;

            }

            Dispatcher.Invoke((Action)delegate ()
            {
                currentCharger.Services[currentDataObjectIndex].Textbox.Text = returnString;
            });
            currentDataObjectIndex++;
            if (currentDataObjectIndex >= currentCharger.Services.Count)
            {
                currentDataObjectIndex = 0;
            }
            if (isLogging)
            {
                logTimer.Start();
            }
        }

        void ClientServicesList_ListChanged(object sender, ListChangedEventArgs e)
        {

        }

           void listviewDevices_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            BluetoothDevice selectedDevice = (BluetoothDevice)listviewDevices.SelectedItem;
            if (isScanning)
            {
                btScan.Content = "Start Scan";
                isScanning = false;
                rn4020.StopScan();
            }
            Thread.Sleep(100);
            rn4020.ConnectToClient(selectedDevice.Address);
        }

        private void btConnect_Click(object sender, RoutedEventArgs e)
        {
            rn4020.PortName = cbComPortList.SelectedValue.ToString();
            rn4020.Connected += rn4020_Connected;
            rn4020.DeviceList.ListChanged += DeviceList_ListChanged;
            rn4020.ErrorReceived += rn4020_ErrorReceived;
            rn4020.OKReceived += rn4020_OKReceived;
            rn4020.ClientServicesUpdated += rn4020_ClientServicesUpdated;
            try
            {
                if (rn4020.IsConnected())
                {
                    rn4020.Close();
                    rn4020.Open();
                }
                else
                {
                    rn4020.Open();
                }
            }
            catch
            {
                Dispatcher.Invoke((Action)delegate() { txtMessage.Text = "Error opening serial port"; });
            }

        }

        void rn4020_ClientServicesUpdated(object sender, EventArgs e)
        {
            BindingList<ClientService> newservicelist = new BindingList<ClientService>(rn4020.ClientServicesList);

            Dispatcher.Invoke((Action)delegate()
            {
                // to do
               // listviewServices.ItemsSource = newservicelist;
            });
        }

        void rn4020_OKReceived(object sender, EventArgs e)
        {
            Dispatcher.Invoke((Action)delegate() { txtMessage.Text = "OK Received"; });
        }

        void rn4020_ErrorReceived(object sender, EventArgs e)
        {
            Dispatcher.Invoke((Action)delegate() { txtMessage.Text = "Error Received"; });
        }

        void DeviceList_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
        {
            BindingList<BluetoothDevice> newlist = new BindingList<BluetoothDevice>(rn4020.DeviceList);

            Dispatcher.Invoke((Action)delegate()
            {
                txtMessage.Text = "New Device Found";
                listviewDevices.ItemsSource = newlist;
            });

        }

        void rn4020_Connected(object sender, EventArgs e)
        {
            Dispatcher.Invoke((Action)delegate() { txtMessage.Text = "Connected to bluetooth device"; });
            rn4020.Reset();
        }

        private void btScan_Click(object sender, RoutedEventArgs e)
        {
            if (rn4020.IsConnected())
            {
                if (isScanning)
                {
                    btScan.Content = "Start Scan";
                    isScanning = false;
                    rn4020.StopScan();
                }
                else
                {
                    btScan.Content = "Stop Scan";
                    isScanning = true;
                    rn4020.StartScan();
                }
            }
            else
            {
                btScan.Content = "Start Scan";
                isScanning = false;
            }
        }

        private void listviewServices_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

        }

        private void btLog_Click(object sender, RoutedEventArgs e)
        {
            if (isLogging)
            {
                btLog.Content = "Start Logging";
                logTimer.Stop();
                isLogging = false;
            }
            else
            {
                btLog.Content = "Stop Logging";
                logTimer.Start();
                isLogging = true;
            }

        }

        private void btLogStop_Click(object sender, RoutedEventArgs e)
        {
            Dispatcher.Invoke((Action)delegate () { textBoxEndTime.Text = DateTime.Now.ToString(); });
        }

        private DateTime ConvertDate(string date, string pattern)
        {
            DateTime retval = DateTime.MinValue;
            if (System.DateTime.TryParseExact(date, pattern, System.Globalization.CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces, out retval))
                return retval;

            // Could not convert date..
            return DateTime.MinValue;
        }

        private void btSetDate_Click(object sender, RoutedEventArgs e)
        {
            rn4020.SetClientServiceValue("0018", DateTime.Now.ToString("yyMMddHHmmss"));
        }
    }

    public class ComboboxItem
    {
        public string Text { get; set; }
        public object Value { get; set; }

        public override string ToString()
        {
            return Text;
        }
    }

    public class Charger
    {
        public string Name { get; set; }
        public string Address { get; set; }
        public int Gain { get; set; }

        public ChargerDataObject ServiceDate { get; set; }
        public ChargerDataObject ServiceDeviceID { get; set; }
        public ChargerDataObject ServiceChargingPower { get; set; }
        public ChargerDataObject ServiceStartTime { get; set; }
        public ChargerDataObject ServiceEndTime { get; set; }
        public ChargerDataObject ServiceTotalCharge { get; set; }
        public ChargerDataObject ServicePowerUpVoltage { get; set; }
        public ChargerDataObject ServicePowerDownVoltage { get; set; }
        public ChargerDataObject ServiceActive { get; set; }

        public List<ChargerDataObject> Services { get; set; }

        public void init() {
            Services = new List<ChargerDataObject>();

            ServiceDate = new ChargerDataObject();
            ServiceDate.id = 0;
            ServiceDate.Handle = "0018";
            ServiceDate.StringValue = "";
            ServiceDate.DataType = typeof(DateTime);
            Services.Add(ServiceDate);

            ServiceDeviceID = new ChargerDataObject();
            ServiceDeviceID.id = 1;
            ServiceDeviceID.Handle = "0022";
            ServiceDeviceID.StringValue = "";
            ServiceDeviceID.DataType = typeof(String);
            Services.Add(ServiceDeviceID);

            ServiceChargingPower = new ChargerDataObject();
            ServiceChargingPower.id = 2;
            ServiceChargingPower.Handle = "001A";
            ServiceChargingPower.StringValue = "";
            ServiceChargingPower.DataType = typeof(Double);
            Services.Add(ServiceChargingPower);

            ServiceStartTime = new ChargerDataObject();
            ServiceStartTime.id = 3;
            ServiceStartTime.Handle = "0024";
            ServiceStartTime.StringValue = "";
            ServiceStartTime.DataType = typeof(DateTime);
            Services.Add(ServiceStartTime);

            ServiceEndTime = new ChargerDataObject();
            ServiceEndTime.id = 4;
            ServiceEndTime.Handle = "0028";
            ServiceEndTime.StringValue = "";
            ServiceEndTime.DataType = typeof(DateTime);
            Services.Add(ServiceEndTime);

            ServiceTotalCharge = new ChargerDataObject();
            ServiceTotalCharge.id = 5;
            ServiceTotalCharge.Handle = "0026";
            ServiceTotalCharge.StringValue = "";
            ServiceTotalCharge.DataType = typeof(Double);
            Services.Add(ServiceTotalCharge);

            ServicePowerUpVoltage = new ChargerDataObject();
            ServicePowerUpVoltage.id = 6;
            ServicePowerUpVoltage.Handle = "0020";
            ServicePowerUpVoltage.StringValue = "";
            ServicePowerUpVoltage.DataType = typeof(Double);
            Services.Add(ServicePowerUpVoltage);

            ServicePowerDownVoltage = new ChargerDataObject();
            ServicePowerDownVoltage.id = 7;
            ServicePowerDownVoltage.Handle = "001E";
            ServicePowerDownVoltage.StringValue = "";
            ServicePowerDownVoltage.DataType = typeof(Double);
            Services.Add(ServicePowerDownVoltage);

            ServiceActive = new ChargerDataObject();
            ServiceActive.id = 8;
            ServiceActive.Handle = "001C";
            ServiceActive.StringValue = "";
            ServiceActive.DataType = typeof(Boolean);
            Services.Add(ServiceActive);
        }

    }

    public class ChargerDataObject
    {
        public string Handle { get; set; }
        public string StringValue { get; set; }
        public TextBox Textbox { get; set; }
        public Type DataType { get; set; }
        public Object Value { get; set; }
        public int id { get; set; }
    }
}


text:
namespace chromeos {
namespace {

bool IsCertInCertificateList(const net::X509Certificate* cert,
                             const net::CertificateList& cert_list) {
  for (net::CertificateList::const_iterator it = cert_list.begin();
       it != cert_list.end();
       ++it) {
    if (net::X509Certificate::IsSameOSCert((*it)->os_cert_handle(),
                                            cert->os_cert_handle())) {
      return true;
    }
  }
  return false;
}

class TestNSSCertDatabase : public net::NSSCertDatabaseChromeOS {
 public:
  TestNSSCertDatabase(crypto::ScopedPK11Slot public_slot,
                      crypto::ScopedPK11Slot private_slot)
      : NSSCertDatabaseChromeOS(std::move(public_slot),
                                std::move(private_slot)) {}
  ~TestNSSCertDatabase() override {}

  void NotifyOfCertAdded(const net::X509Certificate* cert) {
    NSSCertDatabaseChromeOS::NotifyObserversOfCertAdded(cert);
  }
};

class CertLoaderTest : public testing::Test,
                       public CertLoader::Observer {
 public:
  CertLoaderTest()
      : cert_loader_(nullptr), certificates_loaded_events_count_(0U) {}

  ~CertLoaderTest() override {}

  void SetUp() override {
    ASSERT_TRUE(primary_db_.is_open());

    CertLoader::Initialize();
    cert_loader_ = CertLoader::Get();
    cert_loader_->AddObserver(this);
  }

  void TearDown() override {
    cert_loader_->RemoveObserver(this);
    CertLoader::Shutdown();
  }

 protected:
  void StartCertLoaderWithPrimaryDB() {
    CreateCertDatabase(&primary_db_, &primary_certdb_);
    cert_loader_->StartWithNSSDB(primary_certdb_.get());

    base::RunLoop().RunUntilIdle();
    GetAndResetCertificatesLoadedEventsCount();
  }

  // CertLoader::Observer:
  // The test keeps count of times the observer method was called.
  void OnCertificatesLoaded(const net::CertificateList& cert_list,
                            bool initial_load) override {
    EXPECT_TRUE(certificates_loaded_events_count_ == 0 || !initial_load);
    certificates_loaded_events_count_++;
  }

  // Returns the number of |OnCertificatesLoaded| calls observed since the
  // last call to this method equals |value|.
  size_t GetAndResetCertificatesLoadedEventsCount() {
    size_t result = certificates_loaded_events_count_;
    certificates_loaded_events_count_ = 0;
    return result;
  }

  void CreateCertDatabase(crypto::ScopedTestNSSDB* db,
                          std::unique_ptr<TestNSSCertDatabase>* certdb) {
    ASSERT_TRUE(db->is_open());

    certdb->reset(new TestNSSCertDatabase(
        crypto::ScopedPK11Slot(PK11_ReferenceSlot(db->slot())),
        crypto::ScopedPK11Slot(PK11_ReferenceSlot(db->slot()))));
    (*certdb)->SetSlowTaskRunnerForTest(message_loop_.task_runner());
  }

  void ImportCACert(const std::string& cert_file,
                    net::NSSCertDatabase* database,
                    net::CertificateList* imported_certs) {
    ASSERT_TRUE(database);
    ASSERT_TRUE(imported_certs);

    *imported_certs = net::CreateCertificateListFromFile(
        net::GetTestCertsDirectory(),
        cert_file,
        net::X509Certificate::FORMAT_AUTO);
    ASSERT_EQ(1U, imported_certs->size());

    net::NSSCertDatabase::ImportCertFailureList failed;
    ASSERT_TRUE(database->ImportCACerts(*imported_certs,
                                        net::NSSCertDatabase::TRUST_DEFAULT,
                                        &failed));
    ASSERT_TRUE(failed.empty());
  }

  scoped_refptr<net::X509Certificate> ImportClientCertAndKey(
      TestNSSCertDatabase* database) {
    // Import a client cert signed by that CA.
    scoped_refptr<net::X509Certificate> client_cert(
        net::ImportClientCertAndKeyFromFile(net::GetTestCertsDirectory(),
                                            "client_1.pem", "client_1.pk8",
                                            database->GetPrivateSlot().get()));
    database->NotifyOfCertAdded(client_cert.get());
    return client_cert;
  }

  CertLoader* cert_loader_;

  // The user is primary as the one whose certificates CertLoader handles, it
  // has nothing to do with crypto::InitializeNSSForChromeOSUser is_primary_user
  // parameter (which is irrelevant for these tests).
  crypto::ScopedTestNSSDB primary_db_;
  std::unique_ptr<TestNSSCertDatabase> primary_certdb_;

  base::MessageLoop message_loop_;

 private:
  size_t certificates_loaded_events_count_;
};

}  // namespace

TEST_F(CertLoaderTest, Basic) {
  EXPECT_FALSE(cert_loader_->CertificatesLoading());
  EXPECT_FALSE(cert_loader_->certificates_loaded());

  CreateCertDatabase(&primary_db_, &primary_certdb_);
  cert_loader_->StartWithNSSDB(primary_certdb_.get());

  EXPECT_FALSE(cert_loader_->certificates_loaded());
  EXPECT_TRUE(cert_loader_->CertificatesLoading());
  EXPECT_TRUE(cert_loader_->cert_list().empty());

  ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount());
  base::RunLoop().RunUntilIdle();
  EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount());

  EXPECT_TRUE(cert_loader_->certificates_loaded());
  EXPECT_FALSE(cert_loader_->CertificatesLoading());

  // Default CA cert roots should get loaded.
  EXPECT_FALSE(cert_loader_->cert_list().empty());
}

TEST_F(CertLoaderTest, CertLoaderUpdatesCertListOnNewCert) {
  StartCertLoaderWithPrimaryDB();

  net::CertificateList certs;
  ImportCACert("root_ca_cert.pem", primary_certdb_.get(), &certs);

  // Certs are loaded asynchronously, so the new cert should not yet be in the
  // cert list.
  EXPECT_FALSE(
      IsCertInCertificateList(certs[0].get(), cert_loader_->cert_list()));

  ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount());
  base::RunLoop().RunUntilIdle();
  EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount());

  // The certificate list should be updated now, as the message loop's been run.
  EXPECT_TRUE(
      IsCertInCertificateList(certs[0].get(), cert_loader_->cert_list()));

  EXPECT_FALSE(cert_loader_->IsCertificateHardwareBacked(certs[0].get()));
}

TEST_F(CertLoaderTest, CertLoaderNoUpdateOnSecondaryDbChanges) {
  crypto::ScopedTestNSSDB secondary_db;
  std::unique_ptr<TestNSSCertDatabase> secondary_certdb;

  StartCertLoaderWithPrimaryDB();
  CreateCertDatabase(&secondary_db, &secondary_certdb);

  net::CertificateList certs;
  ImportCACert("root_ca_cert.pem", secondary_certdb.get(), &certs);

  base::RunLoop().RunUntilIdle();

  EXPECT_FALSE(
      IsCertInCertificateList(certs[0].get(), cert_loader_->cert_list()));
}

TEST_F(CertLoaderTest, ClientLoaderUpdateOnNewClientCert) {
  StartCertLoaderWithPrimaryDB();

  scoped_refptr<net::X509Certificate> cert(
      ImportClientCertAndKey(primary_certdb_.get()));

  ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount());
  base::RunLoop().RunUntilIdle();
  EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount());

  EXPECT_TRUE(IsCertInCertificateList(cert.get(), cert_loader_->cert_list()));
}

TEST_F(CertLoaderTest, CertLoaderNoUpdateOnNewClientCertInSecondaryDb) {
  crypto::ScopedTestNSSDB secondary_db;
  std::unique_ptr<TestNSSCertDatabase> secondary_certdb;

  StartCertLoaderWithPrimaryDB();
  CreateCertDatabase(&secondary_db, &secondary_certdb);

  scoped_refptr<net::X509Certificate> cert(
      ImportClientCertAndKey(secondary_certdb.get()));

  base::RunLoop().RunUntilIdle();

  EXPECT_FALSE(IsCertInCertificateList(cert.get(), cert_loader_->cert_list()));
}

TEST_F(CertLoaderTest, UpdatedOnCertRemoval) {
  StartCertLoaderWithPrimaryDB();

  scoped_refptr<net::X509Certificate> cert(
      ImportClientCertAndKey(primary_certdb_.get()));

  base::RunLoop().RunUntilIdle();

  ASSERT_EQ(1U, GetAndResetCertificatesLoadedEventsCount());
  ASSERT_TRUE(IsCertInCertificateList(cert.get(), cert_loader_->cert_list()));

  primary_certdb_->DeleteCertAndKey(cert.get());

  ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount());
  base::RunLoop().RunUntilIdle();
  EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount());

  ASSERT_FALSE(IsCertInCertificateList(cert.get(), cert_loader_->cert_list()));
}

TEST_F(CertLoaderTest, UpdatedOnCACertTrustChange) {
  StartCertLoaderWithPrimaryDB();

  net::CertificateList certs;
  ImportCACert("root_ca_cert.pem", primary_certdb_.get(), &certs);

  base::RunLoop().RunUntilIdle();
  ASSERT_EQ(1U, GetAndResetCertificatesLoadedEventsCount());
  ASSERT_TRUE(
      IsCertInCertificateList(certs[0].get(), cert_loader_->cert_list()));

  // The value that should have been set by |ImportCACert|.
  ASSERT_EQ(net::NSSCertDatabase::TRUST_DEFAULT,
            primary_certdb_->GetCertTrust(certs[0].get(), net::CA_CERT));
  ASSERT_TRUE(primary_certdb_->SetCertTrust(certs[0].get(), net::CA_CERT,
                                            net::NSSCertDatabase::TRUSTED_SSL));

  // Cert trust change should trigger certificate reload in cert_loader_.
  ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount());
  base::RunLoop().RunUntilIdle();
  EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount());
}

}  // namespace chromeos


text:
#ifndef _ONYX_NET_NETWORK_H
#define _ONYX_NET_NETWORK_H

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

#include <onyx/vfs.h>

#ifdef __cplusplus
#include <onyx/net/socket.h>
#endif

#include <onyx/public/socket.h>

struct network_args
{
    uint8_t *buffer;
    uint16_t size;
    struct netif *netif;
};

void network_dispatch_receive(uint8_t *packet, uint16_t len, struct netif *netif);
int network_handle_packet(uint8_t *packet, uint16_t len, struct netif *netif);
const char *network_gethostname();
void network_sethostname(const char *);

#endif


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Arthonia taedescens Nyl.

### Remarks
null


text:
.. _running_examples_top:

====================
Running the Examples
====================

General instructions for running the `example source code <https://github.com/dronekit/dronekit-python/tree/master/examples>`_ are given below. More explicit instructions are provided within the documentation for each example (and within the examples themselves by passing the ``-h`` (help) command line argument).

.. tip::

    The examples all launch the :ref:`dronekit-sitl <dronekit_sitl>` simulator and connect to it by default. The ``--connect`` argument is used to instead specify the :ref:`connection string <get_started_connect_string>` for a target vehicle or an externally managed SITL instance.

To run the examples:

#. :ref:`Install DroneKit-Python <installing_dronekit>` if you have not already done so! Install :ref:`dronekit-sitl <dronekit_sitl>` if you want to test against simulated vehicles.

#. Get the DroneKit-Python example source code onto your local machine. The easiest way to do this
   is to clone the **dronekit-python** repository from Github.

   On the command prompt enter:

   .. code-block:: bash

       git clone http://github.com/dronekit/dronekit-python.git

#. Navigate to the example you wish to run (or specify the full path in the next step). The examples are all stored in
   subdirectories of **dronekit-python/examples/**.

   For example, to run the :ref:`vehicle_state <example-vehicle-state>` example, you would navigate as shown:

   .. code-block:: bash

       cd dronekit-python/examples/vehicle_state/

#. Start the example as shown:

   * To connect to a simulator started/managed by the script:

     .. code-block:: bash

         python vehicle_state.py

   * To connect to a specific vehicle, pass its :ref:`connection string <get_started_connect_string>` via the ``connect`` argument.
     For example, to run the example on Solo you would use the following command:

     .. code-block:: bash

         python vehicle_state.py --connect udpin:0.0.0.0:14550

.. warning::

    Propellers should be removed before testing examples indoors (on real vehicles).


text:
import { CommandMetadataOption, Footnote, validators } from '@ionic/cli-framework';

import { CommandInstanceInfo, CommandLineInputs, CommandLineOptions, CommandMetadata, CommandPreRun } from '../../definitions';
import { input, strong } from '../../lib/color';
import { FatalException, RunnerException } from '../../lib/errors';
import { filterArgumentsForCordova, generateOptionsForCordovaBuild } from '../../lib/integrations/cordova/utils';

import { CORDOVA_BUILD_EXAMPLE_COMMANDS, CORDOVA_COMPILE_OPTIONS, CordovaCommand } from './base';

export class BuildCommand extends CordovaCommand implements CommandPreRun {
  async getMetadata(): Promise<CommandMetadata> {
    const exampleCommands = CORDOVA_BUILD_EXAMPLE_COMMANDS.sort();
    const options: CommandMetadataOption[] = [
      // Build Options
      {
        name: 'build',
        summary: 'Do not invoke an Ionic build',
        type: Boolean,
        default: true,
      },
      ...CORDOVA_COMPILE_OPTIONS,
    ];

    const footnotes: Footnote[] = [
      {
        id: 'cordova-android-using-flags',
        url: 'https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#using-flags',
      },
      {
        id: 'cordova-ios-using-flags',
        url: 'https://cordova.apache.org/docs/en/latest/guide/platforms/ios/index.html#using-flags',
      },
    ];

    const runner = this.project && await this.project.getBuildRunner();

    if (runner) {
      const libmetadata = await runner.getCommandMetadata();
      options.push(...(libmetadata.options || []).filter(o => o.groups && o.groups.includes('cordova')));
      footnotes.push(...libmetadata.footnotes || []);
    }

    return {
      name: 'build',
      type: 'project',
      summary: 'Use Cordova to build for Android and iOS platform targets',
      description: `
Like running ${input('cordova build')} directly, ${input('ionic cordova build')} also builds web assets from ${input('ionic build')} and provides friendly checks for Android and iOS platforms.

To pass additional options to the Cordova CLI, use the ${input('--')} separator after the Ionic CLI arguments.

The Cordova CLI requires a separator for platform-specific arguments for Android builds[^cordova-android-using-flags], so an additional separator is required for the Ionic CLI, but it is not required for iOS builds[^cordova-ios-using-flags]. See the example commands for usage with separators. To avoid using flags, consider using ${input('--buildConfig')} with a ${strong('build.json')} file.
      `,
      footnotes,
      exampleCommands,
      inputs: [
        {
          name: 'platform',
          summary: `The platform to build (e.g. ${['android', 'ios'].map(v => input(v)).join(', ')})`,
          validators: [validators.required],
        },
      ],
      options,
    };
  }

  async preRun(inputs: CommandLineInputs, options: CommandLineOptions, runinfo: CommandInstanceInfo): Promise<void> {
    await this.preRunChecks(runinfo);

    if (!inputs[0]) {
      const platform = await this.env.prompt({
        type: 'input',
        name: 'platform',
        message: `What platform would you like to build (${['android', 'ios'].map(v => input(v)).join(', ')}):`,
      });

      inputs[0] = platform.trim();
    }

    await this.checkForPlatformInstallation(inputs[0]);
  }

  async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
    const metadata = await this.getMetadata();

    if (!this.project) {
      throw new FatalException(`Cannot run ${input('ionic cordova build')} outside a project directory.`);
    }

    if (options.build) {
      try {
        const runner = await this.project.requireBuildRunner();
        const runnerOpts = runner.createOptionsFromCommandLine(inputs, generateOptionsForCordovaBuild(metadata, inputs, options));
        await runner.run(runnerOpts);
      } catch (e) {
        if (e instanceof RunnerException) {
          throw new FatalException(e.message);
        }

        throw e;
      }
    }

    const cordovaArgs = filterArgumentsForCordova(metadata, options);
    await this.runCordova(cordovaArgs, { stdio: 'inherit' });
  }
}


text:
/// <reference path="../../baseHelpers.ts"/>
/// <reference path="fabricInterfaces.ts"/>
/// <reference path="fabricDialogs.ts"/>
/// <reference path="fabricGlobals.ts"/>
/// <reference path="jolokiaHelpers.ts"/>
/// <reference path="../../ui/js/dropDown.ts"/>
module ContainerHelpers {

  export var NO_LOCATION = "No Location";

  /**
   * Builds a string array of locations from an array of containers
   */
  export function extractLocations(containers:Array<Fabric.Container>):Array<string> {
    var locations = <Array<string>>containers.map((container) => {
      if (Core.isBlank(container['location'])) {
        return NO_LOCATION;
      } else {
        return container['location'];
      }
    });
    locations.push(NO_LOCATION);
    locations = locations.unique().sortBy('');
    locations = <Array<string>>locations.exclude((location) => {
      return Core.isBlank(location);
    });
    return locations;
  }

  export interface WithSelectedContainers {
    selectedContainers: Array<Fabric.Container>;
  }

  export function getCreateLocationDialog($scope:WithSelectedContainers, $dialog):any {
    return Fabric.getCreateLocationDialog($dialog, <Fabric.CreateLocationDialogOptions>{
      selectedContainers: () => {
        return $scope.selectedContainers;
      },
      callbacks: () => {
        return <Fabric.JolokiaCallbacks>{
          success: (response) => {
            Core.$apply(<any>$scope);
          },
          error: (response) => {
            Core.$apply(<any>$scope);
          }
        };
      }
    });
  }

  /**
   * Interface that describes the required members on a scope passed into 'buildLocationMenu'
   */
  export interface WithCreateLocationDialog extends WithSelectedContainers {
    selectedContainers: Array<Fabric.Container>;
    createLocationDialog: any;
  }

  /**
   * Builds a UI.MenuItem from an array of locations, menu items contain actions to apply the selected menu item onto the selected containers
   */
  export function buildLocationMenu($scope:WithCreateLocationDialog, jolokia, locations:Array<string>):UI.MenuItem {
    var locationMenu = <UI.MenuItem>{
      icon: 'icon-location-arrow',
      title: 'Set Location',
      items: []
    };
    var menuItems = <Array<UI.MenuItem>>[];
    locations.forEach((location) => {
      menuItems.push(<UI.MenuItem>{
        title: location,
        action: () => {
          $scope.selectedContainers.forEach((container:Fabric.Container) => {
            var arg = location;
            if (arg === NO_LOCATION) {
              arg = "";
            }
            Fabric.setContainerProperty(jolokia, container.id, 'location', arg, () => {
                Core.$apply(<any>$scope);
              }, () => {
                Core.$apply(<any>$scope);
              });
          });
        }
      });
    });
    menuItems.push({
      title: "New...",
      action: () => {
        $scope.createLocationDialog.open();
      }
    });
    locationMenu.items = menuItems;
    return locationMenu
  }

  export function isCurrentContainer(container) {
    if (!container) {
      return false;
    }
    if (Core.isBlank(Fabric.currentContainerId)) {
      return false;
    }
    if (angular.isObject(container)) {
      return container['id'] === Fabric.currentContainerId;
    }
    if (angular.isString(container)) {
      return container === Fabric.currentContainerId;
    }

    return false;
  };

  export function canConnect(container) {
    if (!container) {
      return false;
    }
    if (Core.isBlank(container['jolokiaUrl'])) {
      return false;
    }

    if (!Core.parseBooleanValue(container['alive'])) {
      return false;
    }
    return true;
  };

  export function statusTitle(container) {
    var answer = 'Alive';
    if (!container.alive) {
      answer = 'Not Running';
    } else {
      answer += ' - ' + Core.humanizeValue(container.provisionResult);
    }
    return answer;
  }

  export function statusIcon(row:Fabric.Container) {
    if (row) {
      switch(row.provisionResult) {
        case 'success':
          if (row.alive) {
            return "green icon-play-circle";
          } else {
            return "orange icon-off";
          }
        case 'downloading':
          return "icon-download-alt";
        case 'installing':
          return "icon-hdd";
        case 'analyzing':
        case 'finalizing':
          return "icon-refresh icon-spin";
        case 'resolving':
          return "icon-sitemap";
        case 'error':
          return "red icon-warning-sign";
      }
      if (!row.alive) {
        return "orange icon-off";
      }
    }
    return "icon-refresh icon-spin";
  }

  export function gotoContainer($location, container:Fabric.Container) {
    $location.path('/fabric/container/' + container.id);
  }

  export function doDeleteContainer($scope, jolokia, name, onDelete:() => any = null) {
    Fabric.destroyContainer(jolokia, name, () => {
      if (onDelete) {
        onDelete();
      }
      Core.$apply($scope);
    });
  }

  export function doStartContainer($scope, jolokia, name) {
    if ($scope.fabricVerboseNotifications) {
      Core.notification('info', "Starting " + name);
    }
    Fabric.startContainer(jolokia, name, () => {
      Core.$apply($scope);
    });
  }

  export function doStopContainer($scope, jolokia, name) {
    if ($scope.fabricVerboseNotifications) {
      Core.notification('info', "Stopping " + name);
    }
    Fabric.stopContainer(jolokia, name, () => {
      Core.$apply($scope);
    });
  }

  export function stopContainers($scope, jolokia, c:Array<Fabric.Container>) {
    c.forEach((c) => doStopContainer($scope, jolokia, c.id));
  }

  export function startContainers($scope, jolokia, c:Array<Fabric.Container>) {
    c.forEach((c) => doStartContainer($scope, jolokia, c.id));
  }

  export function anyStartable(containers:Array<Fabric.Container>):boolean {
    return containers.length > 0 && containers.any((container:Fabric.Container) => {
      var answer = false;
      if (!container.alive) {
        answer = true;
        switch (container.provisionResult) {
          case 'downloading':
          case 'installing':
          case 'analyzing':
          case 'finalizing':
          case 'resolving':
            answer = false;
        }
      }
      return answer;
    });
  }

  export function anyStoppable(containers:Array<Fabric.Container>):boolean {
    return containers.length > 0 && containers.any((c:Fabric.Container) => c.alive === true);
  }

  export function allAlive(containers:Array<Fabric.Container>, state = true):boolean {
    return containers.length > 0 && containers.every((c:Fabric.Container) => c.alive === state);
  }

  export function decorate($scope, $location, jolokia) {
    if ($scope.containerHelpersAdded) {
      return;
    }
    $scope.containerHelpersAdded = true;
    $scope.isCurrentContainer = isCurrentContainer;
    $scope.canConnect = canConnect;
    $scope.getStatusTitle = statusTitle;
    $scope.showContainer = (container) => {
      gotoContainer($location, container);
    };
    $scope.statusIcon = statusIcon;
    $scope.everySelectionAlive = (state) => {
      return allAlive($scope.selectedContainers, state);
    }
    $scope.anySelectionStartable = () => {
      return anyStartable($scope.selectedContainers);
    }
    $scope.anySelectionStoppable = () => {
      return anyStoppable($scope.selectedContainers);
    }
    $scope.startContainer = (name) => {
      doStartContainer($scope, jolokia, name);
    }
    $scope.stopContainer = (name) => {
      doStopContainer($scope, jolokia, name);
    }
    $scope.startSelectedContainers = () => {
      startContainers($scope, jolokia, $scope.selectedContainers);
    }
    $scope.stopSelectedContainers = () => {
      stopContainers($scope, jolokia, $scope.selectedContainers);
    }
  }

}


text:
class SlackEditionIntegration {
  constructor(slack) {
    this.slack = slack;
  }

  post({ title, ids, total }, results) {
    const info = `${title}. ${ids.length}/${total} articles checked.`;

    if (!results || !results.length) {
      return this.slack.post(`${info} No issues found`);
    }

    const header = `${info} Found ${results.length} problems.`;
    const resultText = results
      .map(result => `(${result.status}): ${result.id} – <${result.url}>`)
      .join(`\n`);
    const text = `${header}\n\`\`\`${resultText}\`\`\``;

    return this.slack.post(text);
  }
}

module.exports = SlackEditionIntegration;


text:
package com.firefly.model;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

public abstract class Model implements Mi{

	/**
	 * 递归自己父的所有Field
	 * @param list
	 */
	private void collectFields(Class<?> clazz,List<Field> list){

		for (Field field:clazz.getDeclaredFields()){
			list.add(field);
		}
		if (clazz.getSuperclass()!=Object.class){
			this.collectFields(clazz.getSuperclass(), list);
		}

	}

	@Override
	public String toString() {

		StringBuffer buffer = new StringBuffer();

		List<Field> list = new ArrayList<Field>();
		this.collectFields(this.getClass(), list);

		for (Field field:list){
			final String name = field.getName();
			field.setAccessible(true);
			try {
				final Object value = field.get(this);
				buffer.append(","+name+"="+value);
			} catch (IllegalArgumentException e) {
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				e.printStackTrace();
			}
		}

		return this.getClass().getSimpleName()+":"+buffer.toString().substring(1);

	}

}


text:
package org.qfox.jestful.client.nio;

import org.qfox.jestful.commons.Config;

import java.io.Serializable;

/**
 * Created by yangchangpei on 17/3/28.
 */
public class Module extends Config implements Serializable {
    private static final long serialVersionUID = -3838624370718465752L;

    private static Module instance;

    private String name;
    private String version;
    private String parentName;
    private String parentVersion;

    private Module() {
    }

    public static Module getInstance() {
        if (instance != null) {
            return instance;
        }
        synchronized (Module.class) {
            if (instance != null) {
                return instance;
            }
            return instance = new Module();
        }
    }

    public String getName() {
        return name;
    }

    public String getVersion() {
        return version;
    }

    public String getParentName() {
        return parentName;
    }

    public String getParentVersion() {
        return parentVersion;
    }

    @Override
    public String toString() {
        return "Module{" +
                "name='" + name + '\'' +
                ", version='" + version + '\'' +
                ", parentName='" + parentName + '\'' +
                ", parentVersion='" + parentVersion + '\'' +
                '}';
    }
}


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Api_debug extends MY_Controller {

    function __construct()
    {
        parent::__construct();
        $this->load->model('api_model');
    }

    function api_admin()
    {
        $data = array();
        $data['query_result'] = '';

        if ($this->input->post('submit'))
        {
			$this->load->library('form_validation');
            $this->form_validation->set_rules('endpoint', 'endpoint', 'required');

			if ($this->input->post('endpoint') == 'info')
			{
				$this->form_validation->set_rules('find_by', 'find by', 'required');
				$this->form_validation->set_rules('id_admin', 'id admin', 'required');
			}

            if ($this->form_validation->run() == TRUE)
            {
				$endpoint = $this->input->post('endpoint');

                $param = array();
                $param['limit'] = $this->input->post('limit');
                $param['offset'] = $this->input->post('offset');
                $param['order'] = $this->input->post('order');
                $param['sort'] = $this->input->post('sort');
                $param['admin_role'] = $this->input->post('admin_role');
                $param['id_admin'] = $this->input->post('id_admin');

                $data['query_result'] = $this->api_model->admin($endpoint, $param);
            }
		}

        $data['code_api_endpoint'] = $this->config->item('code_api_endpoint');
        $data['code_api_admin_order'] = $this->config->item('code_api_admin_order');
        $data['code_api_sort'] = $this->config->item('code_api_sort');
        $data['view_content'] = 'api_debug/api_admin';
        $this->load->view('templates/frame', $data);
    }

    function api_member()
    {
        $data = array();
        $data['query_result'] = '';

        if ($this->input->post('submit'))
        {
			$this->load->library('form_validation');
            $this->form_validation->set_rules('endpoint', 'endpoint', 'required');

            if ($this->form_validation->run() == TRUE)
            {
				$endpoint = $this->input->post('endpoint');

                $param = array();
                $param['limit'] = $this->input->post('limit');
                $param['offset'] = $this->input->post('offset');
                $param['order'] = $this->input->post('order');
                $param['sort'] = $this->input->post('sort');
                $param['idcard_type'] = $this->input->post('idcard_type');
                $param['gender'] = $this->input->post('gender');
                $param['marital_status'] = $this->input->post('marital_status');
                $param['religion'] = $this->input->post('religion');
                $param['shirt_size'] = $this->input->post('shirt_size');
                $param['status'] = $this->input->post('status');
                $param['q'] = $this->input->post('q');

                $data['query_result'] = $this->api_model->member($endpoint, $param);
            }
		}

        $data['code_api_endpoint'] = $this->config->item('code_api_endpoint');
        $data['code_api_member_order'] = $this->config->item('code_api_member_order');
        $data['code_api_sort'] = $this->config->item('code_api_sort');
        $data['code_member_idcard_type'] = $this->config->item('code_member_idcard_type');
        $data['code_member_gender'] = $this->config->item('code_member_gender');
        $data['code_member_marital_status'] = $this->config->item('code_member_marital_status');
        $data['code_member_religion'] = $this->config->item('code_member_religion');
        $data['code_member_shirt_size'] = $this->config->item('code_member_shirt_size');
        $data['code_member_status'] = $this->config->item('code_member_status');
        $data['view_content'] = 'api_debug/api_member';
        $this->load->view('templates/frame', $data);
    }

    function api_post()
    {
        $data = array();
        $data['query_result'] = '';

        if ($this->input->post('submit'))
        {
			$this->load->library('form_validation');
            $this->form_validation->set_rules('endpoint', 'endpoint', 'required');

            if ($this->form_validation->run() == TRUE)
            {
				$endpoint = $this->input->post('endpoint');

                $param = array();
                $param['media_type'] = $this->input->post('media_type');
                $param['type'] = $this->input->post('type');
                $param['status'] = $this->input->post('status');
                $param['is_event'] = $this->input->post('is_event');
                $param['limit'] = $this->input->post('limit');
                $param['offset'] = $this->input->post('offset');
                $param['order'] = $this->input->post('order');
                $param['sort'] = $this->input->post('sort');

                $data['query_result'] = $this->api_model->post($endpoint, $param);
            }
		}

        $data['code_api_endpoint'] = $this->config->item('code_api_endpoint');
        $data['code_api_post_order'] = $this->config->item('code_api_post_order');
        $data['code_api_sort'] = $this->config->item('code_api_sort');
        $data['code_post_media_type'] = $this->config->item('code_post_media_type');
        $data['code_post_type'] = $this->config->item('code_post_type');
        $data['code_post_status'] = $this->config->item('code_post_status');
        $data['code_yes_no'] = $this->config->item('code_yes_no');
        $data['view_content'] = 'api_debug/api_post';
        $this->load->view('templates/frame', $data);
    }
}