text:
@implementation PinyinHelper

//////async methods
+ (void)toHanyuPinyinStringArrayWithChar:(unichar)ch
                                  outputBlock:(OutputArrayBlock)outputBlock
{
       [PinyinHelper getUnformattedHanyuPinyinStringArrayWithChar:ch outputBlock:outputBlock];
}

+ (void)toHanyuPinyinStringArrayWithChar:(unichar)ch
                  withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat
                                  outputBlock:(OutputArrayBlock)outputBlock
{
   return [PinyinHelper getFormattedHanyuPinyinStringArrayWithChar:ch withHanyuPinyinOutputFormat:outputFormat outputBlock:outputBlock];
}

+ (void)getFormattedHanyuPinyinStringArrayWithChar:(unichar)ch
                            withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat
                                            outputBlock:(OutputArrayBlock)outputBlock
{
    [PinyinHelper getUnformattedHanyuPinyinStringArrayWithChar:ch outputBlock:^(NSArray *array) {
        if (outputBlock) {
            if (nil != array) {
                NSMutableArray *targetPinyinStringArray = [NSMutableArray arrayWithCapacity:array.count];
                for (int i = 0; i < (int) [array count]; i++) {
                    [targetPinyinStringArray replaceObjectAtIndex:i withObject:[PinyinFormatter formatHanyuPinyinWithNSString:
                                                                       [array objectAtIndex:i]withHanyuPinyinOutputFormat:outputFormat]];
                }
                outputBlock(targetPinyinStringArray);
            }
            else{
                outputBlock(nil);
            }
        }
    }];
}

+ (void)getUnformattedHanyuPinyinStringArrayWithChar:(unichar)ch
                                              outputBlock:(OutputArrayBlock)outputBlock
{
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
       NSArray *array= [[ChineseToPinyinResource getInstance] getHanyuPinyinStringArrayWithChar:ch];
       dispatch_async(dispatch_get_main_queue(), ^{
            if (outputBlock) {
                outputBlock(array);
            }
        });
    });
}

+ (void)toTongyongPinyinStringArrayWithChar:(unichar)ch
                                     outputBlock:(OutputArrayBlock)outputBlock
{
     return [PinyinHelper convertToTargetPinyinStringArrayWithChar:ch withPinyinRomanizationType: TONGYONG_PINYIN outputBlock:outputBlock];
}

+ (void)toWadeGilesPinyinStringArrayWithChar:(unichar)ch
                                      outputBlock:(OutputArrayBlock)outputBlock
{
    [PinyinHelper convertToTargetPinyinStringArrayWithChar:ch withPinyinRomanizationType: WADEGILES_PINYIN outputBlock:outputBlock];
}

+ (void)toMPS2PinyinStringArrayWithChar:(unichar)ch
                                 outputBlock:(OutputArrayBlock)outputBlock
{
     [PinyinHelper convertToTargetPinyinStringArrayWithChar:ch withPinyinRomanizationType: MPS2_PINYIN outputBlock:outputBlock];
}

+ (void)toYalePinyinStringArrayWithChar:(unichar)ch
                                 outputBlock:(OutputArrayBlock)outputBlock
{
    [PinyinHelper convertToTargetPinyinStringArrayWithChar:ch withPinyinRomanizationType: YALE_PINYIN outputBlock:outputBlock];
}

+ (void)convertToTargetPinyinStringArrayWithChar:(unichar)ch
                           withPinyinRomanizationType:(NSString *)targetPinyinSystem
                                          outputBlock:(OutputArrayBlock)outputBlock
{

     [PinyinHelper getUnformattedHanyuPinyinStringArrayWithChar:ch outputBlock:^(NSArray *array) {
         if (outputBlock) {
             if (nil != array) {
                 NSMutableArray *targetPinyinStringArray = [NSMutableArray arrayWithCapacity:array.count];
                 for (int i = 0; i < (int) [array count]; i++) {
                    ///to do
                 }
                 outputBlock(targetPinyinStringArray);
             }
             else{
                 outputBlock(nil);
             }
         }
     }];
}
+ (void)toGwoyeuRomatzyhStringArrayWithChar:(unichar)ch
                                     outputBlock:(OutputArrayBlock)outputBlock
{

    [PinyinHelper convertToGwoyeuRomatzyhStringArrayWithChar:ch outputBlock:outputBlock];
}

+ (void)convertToGwoyeuRomatzyhStringArrayWithChar:(unichar)ch
                                            outputBlock:(OutputArrayBlock)outputBlock
{
    [PinyinHelper getUnformattedHanyuPinyinStringArrayWithChar:ch outputBlock:^(NSArray *array) {
        if (outputBlock) {
            if (nil != array) {
                NSMutableArray *targetPinyinStringArray = [NSMutableArray arrayWithCapacity:array.count];
                for (int i = 0; i < (int) [array count]; i++) {
                    ///to do
                }
                outputBlock(targetPinyinStringArray);
            }
            else{
                outputBlock(nil);
            }
        }
    }];

}

+ (void)toHanyuPinyinStringWithNSString:(NSString *)str
            withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat
                           withNSString:(NSString *)seperater
                            outputBlock:(OutputStringBlock)outputBlock
{
 //   __block NSMutableString *resultPinyinStrBuf = [[NSMutableString alloc] init];
//    for (int i = 0; i <  str.length; i++) {
//         [PinyinHelper getFirstHanyuPinyinStringWithChar:[str characterAtIndex:i] withHanyuPinyinOutputFormat:outputFormat outputBlock:^(NSString *pinYin) {
//             if (nil != pinYin) {
//                 [resultPinyinStrBuf appendString:pinYin];
//                 if (i != [str length] - 1) {
//                     [resultPinyinStrBuf appendString:seperater];
//                 }
//             }
//             else {
//                 [resultPinyinStrBuf appendFormat:@"%C",[str characterAtIndex:i]];
//             }
//             if (outputBlock) {
//                 outputBlock(resultPinyinStrBuf);
//             }
//
//         }];
//    }
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        __block NSMutableString *resultPinyinStrBuf = [[NSMutableString alloc] init];
        for (int i = 0; i <  str.length; i++) {
            NSString *mainPinyinStrOfChar = [PinyinHelper getFirstHanyuPinyinStringWithChar:[str characterAtIndex:i] withHanyuPinyinOutputFormat:outputFormat];
            if (nil != mainPinyinStrOfChar) {
                [resultPinyinStrBuf appendString:mainPinyinStrOfChar];
                if (i != [str length] - 1) {
                    [resultPinyinStrBuf appendString:seperater];
                }
            }
            else {
                [resultPinyinStrBuf appendFormat:@"%C",[str characterAtIndex:i]];
            }
        }
        dispatch_async(dispatch_get_main_queue(), ^{
            if (outputBlock) {
                outputBlock(resultPinyinStrBuf);
            }
        });
    });
}

+ (void)getFirstHanyuPinyinStringWithChar:(unichar)ch
                    withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat
                                    outputBlock:(OutputStringBlock)outputBlock
{
    [self getFormattedHanyuPinyinStringArrayWithChar:ch withHanyuPinyinOutputFormat:outputFormat outputBlock:^(NSArray *array) {
        if (outputBlock) {
            if ((nil != array) && ((int) [array count] > 0)) {
                outputBlock([array objectAtIndex:0]);
            }else {
               outputBlock(nil);
            }

        }
    }];
}

/////sync methods

+ (NSArray *)toHanyuPinyinStringArrayWithChar:(unichar)ch {
    return [PinyinHelper getUnformattedHanyuPinyinStringArrayWithChar:ch];
}

+ (NSArray *)toHanyuPinyinStringArrayWithChar:(unichar)ch
                  withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat {
    return [PinyinHelper getFormattedHanyuPinyinStringArrayWithChar:ch withHanyuPinyinOutputFormat:outputFormat];
}

+ (NSArray *)getFormattedHanyuPinyinStringArrayWithChar:(unichar)ch
                            withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat {
    NSMutableArray *pinyinStrArray =[NSMutableArray arrayWithArray:[PinyinHelper getUnformattedHanyuPinyinStringArrayWithChar:ch]];
    if (nil != pinyinStrArray) {
        for (int i = 0; i < (int) [pinyinStrArray count]; i++) {
            [pinyinStrArray replaceObjectAtIndex:i withObject:[PinyinFormatter formatHanyuPinyinWithNSString:
                                                               [pinyinStrArray objectAtIndex:i]withHanyuPinyinOutputFormat:outputFormat]];
        }
        return pinyinStrArray;
    }
    else return nil;
}

+ (NSArray *)getUnformattedHanyuPinyinStringArrayWithChar:(unichar)ch {
    return [[ChineseToPinyinResource getInstance] getHanyuPinyinStringArrayWithChar:ch];
}

+ (NSArray *)toTongyongPinyinStringArrayWithChar:(unichar)ch {
    return [PinyinHelper convertToTargetPinyinStringArrayWithChar:ch withPinyinRomanizationType: TONGYONG_PINYIN];
}

+ (NSArray *)toWadeGilesPinyinStringArrayWithChar:(unichar)ch {
    return [PinyinHelper convertToTargetPinyinStringArrayWithChar:ch withPinyinRomanizationType: WADEGILES_PINYIN];
}

+ (NSArray *)toMPS2PinyinStringArrayWithChar:(unichar)ch {
    return [PinyinHelper convertToTargetPinyinStringArrayWithChar:ch withPinyinRomanizationType: MPS2_PINYIN];
}

+ (NSArray *)toYalePinyinStringArrayWithChar:(unichar)ch {
    return [PinyinHelper convertToTargetPinyinStringArrayWithChar:ch withPinyinRomanizationType: YALE_PINYIN];
}

+ (NSArray *)convertToTargetPinyinStringArrayWithChar:(unichar)ch
                           withPinyinRomanizationType:(NSString *)targetPinyinSystem {
    NSArray *hanyuPinyinStringArray = [PinyinHelper getUnformattedHanyuPinyinStringArrayWithChar:ch];
    if (nil != hanyuPinyinStringArray) {
        NSMutableArray *targetPinyinStringArray = [NSMutableArray arrayWithCapacity:hanyuPinyinStringArray.count];
        for (int i = 0; i < (int) [hanyuPinyinStringArray count]; i++) {

        }
        return targetPinyinStringArray;
    }
    else return nil;
}

+ (NSArray *)toGwoyeuRomatzyhStringArrayWithChar:(unichar)ch {
    return [PinyinHelper convertToGwoyeuRomatzyhStringArrayWithChar:ch];
}

+ (NSArray *)convertToGwoyeuRomatzyhStringArrayWithChar:(unichar)ch {
    NSArray *hanyuPinyinStringArray = [PinyinHelper getUnformattedHanyuPinyinStringArrayWithChar:ch];
    if (nil != hanyuPinyinStringArray) {
        NSMutableArray *targetPinyinStringArray =[NSMutableArray arrayWithCapacity:hanyuPinyinStringArray.count];
        for (int i = 0; i < (int) [hanyuPinyinStringArray count]; i++) {
        }
        return targetPinyinStringArray;
    }
    else return nil;
}

+ (NSString *)toHanyuPinyinStringWithNSString:(NSString *)str
                  withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat
                                 withNSString:(NSString *)seperater {
    NSMutableString *resultPinyinStrBuf = [[NSMutableString alloc] init];
    for (int i = 0; i <  str.length; i++) {
        NSString *mainPinyinStrOfChar = [PinyinHelper getFirstHanyuPinyinStringWithChar:[str characterAtIndex:i] withHanyuPinyinOutputFormat:outputFormat];
        if (nil != mainPinyinStrOfChar) {
            [resultPinyinStrBuf appendString:mainPinyinStrOfChar];
            if (i != [str length] - 1) {
                [resultPinyinStrBuf appendString:seperater];
            }
        }
        else {
            [resultPinyinStrBuf appendFormat:@"%C",[str characterAtIndex:i]];
        }
    }
    return resultPinyinStrBuf;
}

+ (NSString *)getFirstHanyuPinyinStringWithChar:(unichar)ch
                    withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat {
    NSArray *pinyinStrArray = [PinyinHelper getFormattedHanyuPinyinStringArrayWithChar:ch withHanyuPinyinOutputFormat:outputFormat];
    if ((nil != pinyinStrArray) && ((int) [pinyinStrArray count] > 0)) {
        return [pinyinStrArray objectAtIndex:0];
    }
    else {
        return nil;
    }
}

@end


text:
/*
 * Created by asmateus on 15.02.2020.
 */

#ifndef PHYSICS_UNITS_H
#define PHYSICS_UNITS_H

#include "geometry.hpp"

namespace physics
{
    using Position = Vector;
    using Size = Vector;
    using Force = Vector;
    using Mass = double;
}

#endif  // PHYSICS_UNITS_H

redpajama_set_name: RedPajamaGithub


text:
package org.efaps.esjp.jms.util;

import org.efaps.admin.program.esjp.EFapsRevision;
import org.efaps.admin.program.esjp.EFapsUUID;

/**
 * TODO comment!
 *
 * @author The eFaps Team
 * @version $Id$
 */
@EFapsUUID("1f001f3a-adab-4829-af59-01549e6c5784")
@EFapsRevision("$Rev$")
public interface JMSSettings
{
}


text:
import platform

from unittest import TestCase
from coadlib.core import Application

class BaseApplicationTester(TestCase):

    def setUp(self):

        self.app = Application("testapp", "test desc", "1.0", 4, 5)

    def tearDown(self):

        pass

    def test_app_attrs(self):

        if platform.system() == "Windows":
            enc = "shift_jis"

        else:
            enc = "utf-8"

        self.assertEqual(self.app.name, "testapp")
        self.assertEqual(self.app.desc, "test desc")
        self.assertEqual(self.app.version, "1.0")
        self.assertEqual(self.app.padding, " "*4)
        self.assertEqual(self.app.margin, "\n"*5)
        self.assertEqual(self.app.encoding, enc)

    def test_app_pp(self):

        msg = u"ハロー\n\n"

        result = u"\n" * 5
        result += u"    ハロー\n"
        result += u"    \n"
        result += u"    "

        self.assertEqual(self.app.pp(msg, margin=True), result)


text: export { default } from 'ember-fhir/models/linkage';


text:
module Stairs
  module EnvAdapters
    class RVM
      def self.present?
        `which rvm`
        $CHILD_STATUS.success?
      end

      def set(name, value)
        Util::FileMutation.replace_or_append(
          Regexp.new("^export #{name}=(.*)$"),
          "export #{name}=#{value}",
          '.rvmrc'
        )
      end

      def unset(name)
        Util::FileMutation.remove Regexp.new("^export #{name}=(.*)\n"), '.rvmrc'
      end
    end
  end
end


text:
package base;

import dbService.DBException;

/**
 * @author v.chibrikov
 */
public interface DBService {
    long addUser(UserProfile userProfile) throws DBException;

    UserProfile getUser(String login) throws DBException;

    void create() throws DBException;

    void cleanUp() throws DBException;

    void check() throws DBException;
}


text:
FROM centos:7

MAINTAINER Dan Kirkwood

RUN	yum -y install \
		epel-release \
		git \
		rpm-build

# all ENV vars can be controlled by, e.g. `docker run -e BRANCH=1.6.x <image>`
ENV GITREPO=https://github.com/Comcast/traffic_control
ENV BRANCH=master

#############################################################################
# Above are common for all sub-projects.

RUN	yum -y install \
		which && \
	yum -y clean all

### java/mvn
WORKDIR /opt
RUN curl -L -b "oraclelicense=a" http://download.oracle.com/otn-pub/java/jdk/8u101-b13/jdk-8u101-linux-x64.tar.gz | tar xzf - && \
    curl -L http://mirror.nexcess.net/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz | tar xzf -
RUN ln -s jdk* java && ln -s apache-maven* maven

RUN alternatives --install /usr/bin/java java /opt/java/bin/java 2 && \
    alternatives --install /usr/bin/jar jar /opt/java/bin/jar 2 && \
    alternatives --install /usr/bin/javac javac /opt/java/bin/javac 2 && \
    alternatives --set java /opt/java/bin/java && \
    alternatives --set jar /opt/java/bin/jar && \
    alternatives --set javac /opt/java/bin/javac && \
    alternatives --install /usr/bin/mvn mvn /opt/maven/bin/mvn 1
###

RUN	mkdir -p /dist
VOLUME	/dist

WORKDIR /
CMD	git clone --branch $BRANCH $GITREPO && cd traffic_control && \
	./traffic_monitor/build/build_rpm.sh && \
	cp -f dist/* /dist/.


text:
import {
  MeshComponent,
  MeshComponentParams
} from '../../core/MeshComponent';

import {
  BufferGeometry,
  Geometry,
  LineCurve3,
  Mesh
} from 'three';

interface LineParams extends MeshComponentParams {

  /** Geometry parameters */
  geometry: {

    /**
     * A LineCurve3 representing the curve to trace as a line
     * @type {LineCurve3}
     */
    curve: LineCurve3;

    /**
     * Points is the number of pieces to divide the curve into.
     * Default is 50.
     */
    points?: number;
  }

  /** Sets whether to build a buffered geometry */
  buffer?: boolean;
}

 export class Line extends MeshComponent {

   /**
    * @description Creates a Line
    * @constructor
    * @param params parameters
    */
   constructor(params?: LineParams);

   /**
    * Build lifecycle creates a mesh using input params.
    * @param params
    */
   build(params?: LineParams): Mesh;

   /**
    * Builds the geometry
    * @param params
    */
   buildGeometry(params?: LineParams): Geometry | BufferGeometry;
}


text:
<?php

namespace Phrest\API;

/**
 * @todo validate consumes/produces = json
 */
class RequestSwaggerValidator
{
    static private $errorCodeMapping = [
        'additionalItems' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_ADDITIONAL_ITEMS,
        'additionalProp' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_ADDITIONAL_PROP,
        'allOf' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_ALL_OF,
        'anyOf' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_ANY_OF,
        'dependencies' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_DEPENDENCIES,
        'disallow' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_DISALLOW,
        'divisibleBy' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_DIVISIBLE_BY,
        'enum' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_ENUM,
        'exclusiveMaximum' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_EXCLUSIVE_MAXIMUM,
        'exclusiveMinimum' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_EXCLUSIVE_MINIMUM,
        'format' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_FORMAT,
        'maximum' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_MAXIMUM,
        'maxItems' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_MAX_ITEMS,
        'maxLength' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_MAX_LENGTH,
        'maxProperties' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_MAX_PROPERTIES,
        'minimum' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_MINIMUM,
        'minItems' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_MIN_ITEMS,
        'minLength' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_MIN_LENGTH,
        'minProperties' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_MIN_PROPERTIES,
        'missingMaximum' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_MISSING_MAXIMUM,
        'missingMinimum' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_MISSING_MINIMUM,
        'multipleOf' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_MULTIPLE_OF,
        'not' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_NOT,
        'oneOf' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_ONE_OF,
        'pattern' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_PATTERN,
        'pregex' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_PREGEX,
        'required' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_REQUIRED,
        'requires' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_REQUIRES,
        'schema' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_SCHEMA,
        'type' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_TYPE,
        'uniqueItems' => \Phrest\API\ErrorCodes::REQUEST_VALIDATION_UNIQUE_ITEMS,
    ];

    static private $moreFields = [
        'minItems',
        'maxItems',
        'additionalItems',
        'enum',
        'format',
        'minimum',
        'maximum',
        'divisibleBy',
        'multipleOf',
        'pregex',
        'minProperties',
        'maxProperties',
        'maxLength',
        'minLength',
        'pattern',
    ];

    /**
     * @var \Phrest\Swagger
     */
    private $swagger;

    /**
     * @var \JsonSchema\Validator
     */
    private $validator;

    public function __construct(\Phrest\Swagger $swagger, \JsonSchema\Validator $validator)
    {
        $this->swagger = $swagger;
        $this->validator = $validator;
    }

    /**
     * @param \Psr\Http\Message\ServerRequestInterface $request
     * @param string $operationId
     * @return RequestSwaggerData
     * @throws \Phrest\Http\Exception
     */
    public function validate(\Psr\Http\Message\ServerRequestInterface $request, string $operationId): RequestSwaggerData
    {
        $parameters = $this->swagger->getParameters($operationId);

        // @todo own required validation - json-schema throws type error (NULL != string, number, ...)

        $errors = [];

        // validate query parameters
        $queryValues = [];
        foreach ($parameters->getQueryParameters() as $parameterName => $parameter) {
            $required = $parameter['required'] ?? false;
            $value = $request->getQueryParams()[$parameterName] ?? ($parameter['default'] ?? null);
            if(!is_null($value) || $required) {
                $errors = array_merge(
                    $errors,
                    $this->validateValueBySchema($value, $parameter, '{query}/' . $parameterName)
                );
            }
            $queryValues[$parameterName] = $value;
        }

        // validate header parameters
        $headerValues = [];
        foreach ($parameters->getHeaderParameters() as $parameterName => $parameter) {
            $required = $parameter['required'] ?? false;
            $value = $request->getHeader($parameterName)[0] ?? ($parameter['default'] ?? null);
            if(!is_null($value) || $required) {
                $errors = array_merge(
                    $errors,
                    $this->validateValueBySchema($value, $parameter, '{header}/' . $parameterName)
                );
            }
            $headerValues[$parameterName] = $value;
        }

        // validate path parameters
        $pathValues = [];
        foreach ($parameters->getPathParameters() as $parameterName => $parameter) {
            /* @todo default: does this make sense? */
            $value = $request->getAttribute($parameterName, $parameter['default'] ?? null);
            $errors = array_merge(
                $errors,
                $this->validateValueBySchema($value, $parameter, '{path}/' . $parameterName)
            );
            $pathValues[$parameterName] = $value;
        }

        // validate body
        $bodyValue = null;
        $bodyParameter = $parameters->getBodyParameter();
        if (count($bodyParameter)) {
            $value = $request->getAttribute(\Phrest\Middleware\JsonRequestBody::JSON_OBJECT_ATTRIBUTE);
            $errors = array_merge(
                $errors,
                $this->validateValueBySchema($value, $bodyParameter['schema'], '{body}')
            );
            $bodyValue = $value;
        }

        if (count($errors)) {
            throw \Phrest\Http\Exception::BadRequest(
                new \Phrest\API\Error(
                    \Phrest\API\ErrorCodes::REQUEST_PARAMETER_VALIDATION,
                    'request parameter validation failed. OperationId: '.$operationId,
                    ...$errors
                )
            );
        }

        return new RequestSwaggerData($bodyValue, $queryValues, $pathValues, $headerValues);
    }

    private function validateValueBySchema(&$value, $schema, $fieldName)
    {
        $this->validator->reset();

        $this->validator->validate(
            $value,
            $schema,
            \JsonSchema\Constraints\Constraint::CHECK_MODE_NORMAL
            | \JsonSchema\Constraints\Constraint::CHECK_MODE_APPLY_DEFAULTS
            | \JsonSchema\Constraints\Constraint::CHECK_MODE_COERCE_TYPES
        );

        $errors = [];
        if (!$this->validator->isValid()) {
            foreach ($this->validator->getErrors() as $validatorError) {
                $more = array_intersect_key(
                    $validatorError,
                    array_flip(self::$moreFields)
                );

                $errors[] = new \Phrest\API\ErrorEntry(
                    self::$errorCodeMapping[$validatorError['constraint']] ?? \Phrest\API\ErrorCodes::UNKNOWN,
                    $fieldName . $validatorError['pointer'],
                    $validatorError['message'],

                    /** @todo: find better format - custom formatter? */
                    json_encode($more)
                );
            }
        }

        return $errors;
    }
}


text:
package org.readium.sdk.android.launcher;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONException;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;

import org.readium.sdk.android.Container;
import org.readium.sdk.android.Package;
import org.readium.sdk.android.SpineItem;
import org.readium.sdk.android.launcher.model.OpenPageRequest;

public class SpineItemsActivity extends Activity {

	protected static final String TAG = "SpineItemsActivity";
	private Context context;
    private Button back;
	private Package pckg;
	private long containerId;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.spine_items);

        context = this;
        back = (Button) findViewById(R.id.backToBookView1);
        Intent intent = getIntent();
        if (intent.getFlags() == Intent.FLAG_ACTIVITY_NEW_TASK) {
            Bundle extras = intent.getExtras();
            if (extras != null) {
                String value = extras.getString(Constants.BOOK_NAME);
                back.setText(value);
                containerId = extras.getLong(Constants.CONTAINER_ID);
                Container container = ContainerHolder.getInstance().get(containerId);
                if (container == null) {
                	finish();
                	return;
                }
                pckg = container.getDefaultPackage();
            }
        }

        final ListView items = (ListView) findViewById(R.id.spineItems);

        List<SpineItem> spineItems = new ArrayList<SpineItem>();
        if (pckg != null) {
        	spineItems = pckg.getSpineItems();
        }

        this.setListViewContent(items, spineItems);

        initListener();
    }

    private void setListViewContent(ListView view, final List<SpineItem> spineItems) {
    	final List<String> list = new ArrayList<String>();
    	for (SpineItem si : spineItems) {
			list.add(si.getIdRef());
		}
        BookListAdapter bookListAdapter = new BookListAdapter(this, list);
        view.setAdapter(bookListAdapter);
        view.setOnItemClickListener(new ListView.OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> arg0, View view, int position,
                    long arg3) {
                Toast.makeText(context, "this is item " + list.get(position),
                        Toast.LENGTH_SHORT).show();
        		Intent intent = new Intent(SpineItemsActivity.this, WebViewActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        		intent.putExtra(Constants.CONTAINER_ID, containerId);

        		OpenPageRequest openPageRequest = OpenPageRequest.fromIdref(spineItems.get(position).getIdRef());
        		try {
					intent.putExtra(Constants.OPEN_PAGE_REQUEST_DATA, openPageRequest.toJSON().toString());
            		startActivity(intent);
				} catch (JSONException e) {
					Log.e(TAG, ""+e.getMessage(), e);
				}
            }
        });
    }

    private void initListener() {
        back.setOnClickListener(new Button.OnClickListener() {

            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}


text:
/**
 * @file rotate.ts 立方体翻页效果
 *
 * @author: zhangbobell
 * @email: zhangbobell@163.com
 *
 * @created: 2017.06.27
 */

import Render from '../render';

import { EMPTY_PAGE, OPPSITE } from '../constant';

type Sign = 0 | -1 | 1;

export default class Rotate extends Render {

    doRender(swiper:any) {
        const axis = swiper.axis;
        const sideOffset = swiper.sideOffset;
        const sideLength = swiper.sideLength;
        const rotateAxis = OPPSITE[axis];

        const moveDirection = swiper.moveDirection;
        const rotateSign: Sign = axis === 'Y' ? -1 : 1;

        // compute
        const swiperCss = `-webkit-perspective:${sideLength * 4}px;-webkit-transform-style:preserve-3d;`;
        const currentTransform = `rotate${rotateAxis}(${rotateSign * 90 * sideOffset / sideLength}deg) translateZ(${0.889 * sideLength / 2}px) scale(0.889)`;
        const activeTransform = `rotate${rotateAxis}(${rotateSign * 90 * (sideOffset / sideLength - moveDirection)}deg) translateZ(${0.889 * sideLength / 2}px) scale(0.889)`;

        // apply
        swiper.$swiper.style.cssText = swiperCss;
        swiper.currentPage.style.webkitTransform = currentTransform;
        if (swiper.activePage !== EMPTY_PAGE) {
            swiper.activePage.style.webkitTransform = activeTransform;
        }
    }
}


text:
package com.caucho.hessian.io.java8;

import com.caucho.hessian.io.HessianHandle;

import java.io.Serializable;

/**
 * author: Zhang Li
 * created on 15-3-25.
 */
public abstract class Java8TimeHandle<T> implements HessianHandle, Serializable {

    private static final long serialVersionUID = -8160221934616339966L;

    /**
     * @param time
     */
    public abstract void init(T time);
}


text:
layout: default
---

  <time class="published" datetime="{{ page.date | date: '%Y-%m-%d' }}">{{ page.date | date_to_long_string }}</time>

{{ page.title }}

  {{ content }}


text:
from django.utils import simplejson

from oembed.exceptions import OEmbedException

class OEmbedResource(object):
    """
    OEmbed resource, as well as a factory for creating resource instances
    from response json
    """
    _data = {}
    content_object = None

    def __getattr__(self, name):
        return self._data.get(name)

    def get_data(self):
        return self._data

    def load_data(self, data):
        self._data = data

    @property
    def json(self):
        return simplejson.dumps(self._data)

    @classmethod
    def create(cls, data):
        if not 'type' in data or not 'version' in data:
            raise OEmbedException('Missing required fields on OEmbed response.')

        data['width'] = data.get('width') and int(data['width']) or None
        data['height'] = data.get('height') and int(data['height']) or None

        filtered_data = dict([(k, v) for k, v in data.items() if v])

        resource = cls()
        resource.load_data(filtered_data)

        return resource

    @classmethod
    def create_json(cls, raw):
        data = simplejson.loads(raw)
        return cls.create(data)


text:
<?php

namespace Anax\Posts;

/**
 * Model for Posts.
 *
 */
class PostsControllerTest extends \PHPUnit_Framework_TestCase {

}


text:
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsUCConstructors.h"
#include "nsUnicodeToMacFarsi.h"

//----------------------------------------------------------------------
// Global functions and data [declaration]

static const uint16_t g_ufMappingTable[] = {
#include "macfarsi.uf"
};

nsresult
nsUnicodeToMacFarsiConstructor(nsISupports *aOuter, REFNSIID aIID,
                               void **aResult)
{
  return CreateTableEncoder(u1ByteCharset,
                            (uMappingTable*) &g_ufMappingTable, 1,
                            aOuter, aIID, aResult);
}


text:
package net

import (
	"strings"
)

func ParseNetwork(nwStr string) Network {
	if network, found := Network_value[nwStr]; found {
		return Network(network)
	}
	switch strings.ToLower(nwStr) {
	case "tcp":
		return Network_TCP
	case "udp":
		return Network_UDP
	default:
		return Network_Unknown
	}
}

func (n Network) AsList() *NetworkList {
	return &NetworkList{
		Network: []Network{n},
	}
}

func (n Network) SystemString() string {
	switch n {
	case Network_TCP:
		return "tcp"
	case Network_UDP:
		return "udp"
	default:
		return "unknown"
	}
}

func (n Network) URLPrefix() string {
	switch n {
	case Network_TCP:
		return "tcp"
	case Network_UDP:
		return "udp"
	default:
		return "unknown"
	}
}

func HasNetwork(list []Network, network Network) bool {
	for _, value := range list {
		if string(value) == string(network) {
			return true
		}
	}
	return false
}

// HasNetwork returns true if the given network is in v NetworkList.
func (l NetworkList) HasNetwork(network Network) bool {
	for _, value := range l.Network {
		if string(value) == string(network) {
			return true
		}
	}
	return false
}

func (l NetworkList) Get(idx int) Network {
	return l.Network[idx]
}

// Size returns the number of networks in this network list.
func (l NetworkList) Size() int {
	return len(l.Network)
}


text:
```bash
$ ./create <number of machines> vb
```


text: <manifest package="com.getkeepsafe.taptargetview"/>


text:
'use strict';
angular.module('myApp.view1', ['ngRoute']);
app.config(['$routeProvider', function ($routeProvider) {
    $routeProvider.when('/view1', {
        templateUrl: 'view1/view1.html',
        controller: 'View1Ctrl'
    });
}
]);
app.controller('View1Ctrl', ['$scope', function ($scope) {
    var records = [{
        amount: 1,
        name: "ddd",
        paid: true,
        time: new Date(),
        groupId: 1

    }, {
        amount: -100,
        name: "zp",
        paid: true,
        time: new Date(),
    },];
    var groups = [{
        id: 1,
        amount: 100,
        name: "ddd",
        time: new Date()
    }, {
        id: 2,
        amount: 100,
        name: "zp",
        time: new Date()
    },];
    $scope.day = new Date().getDate();
    $scope.hideEdit = true;
    $scope.amount = 0;
    var today = new Date();
    $scope.currentMonth = today.getMonth();
    $scope.currentYear = today.getFullYear();
    $scope.currentRecords = [];
    $scope.expectedExpences = 0;
    $scope.currentAmount = 0;
    $scope.leftAmount = 0;
    setCurrentRecords($scope, filter(addRecordFromPrevMonth(records,$scope.currentYear, $scope.currentMonth), $scope.currentYear, $scope.currentMonth), filter(groups, $scope.currentYear, $scope.currentMonth));
    $scope.prev = function () {
        $scope.currentMonth--;
        if ($scope.currentMonth < 0) {
            $scope.currentYear--;
            $scope.currentMonth = 11;
        }
        setCurrentRecords($scope, filter(addRecordFromPrevMonth(records,$scope.currentYear, $scope.currentMonth), $scope.currentYear, $scope.currentMonth), filter(groups, $scope.currentYear, $scope.currentMonth));
    }
    $scope.current = function () {
        $scope.currentMonth = today.getMonth();
        $scope.currentYear = today.getFullYear();
        setCurrentRecords($scope, filter(addRecordFromPrevMonth(records,$scope.currentYear, $scope.currentMonth), $scope.currentYear, $scope.currentMonth), filter(groups, $scope.currentYear, $scope.currentMonth));
    }
    $scope.next = function () {
        $scope.currentMonth++;
        if ($scope.currentMonth > 11) {
            $scope.currentYear++;
            $scope.currentMonth = 0;
        }
        setCurrentRecords($scope, filter(addRecordFromPrevMonth(records,$scope.currentYear, $scope.currentMonth), $scope.currentYear, $scope.currentMonth), filter(groups, $scope.currentYear, $scope.currentMonth));
    }
    $scope.edit = function () {
        if ($scope.hideEdit == false)
            $scope.hideEdit = true;
        else
            $scope.hideEdit = false;
    }
    $scope.delete = function (record) {
        records = removeItem(record, records);
        setCurrentRecords($scope, filter(addRecordFromPrevMonth(records,$scope.currentYear, $scope.currentMonth), $scope.currentYear, $scope.currentMonth), filter(groups, $scope.currentYear, $scope.currentMonth));
    }
    $scope.showEdit = function (record) {
        record.edit = true;
    }
    $scope.saveRecord = function (record) {
        record.edit = false;
        setCurrentRecords($scope, filter(addRecordFromPrevMonth(records,$scope.currentYear, $scope.currentMonth), $scope.currentYear, $scope.currentMonth), filter(groups, $scope.currentYear, $scope.currentMonth));
    }
    $scope.save = function () {
        if ($scope.repeat) {
        } else if ($scope.group) {
            groups.push({
                amount: parseInt($scope.amount),
                name: $scope.name,
                time: new Date($scope.currentYear,$scope.currentMonth,$scope.day)
            });
        } else {
            records.push({
                amount: parseInt($scope.amount),
                name: $scope.name,
                paid: $scope.paid,
                time: new Date($scope.currentYear,$scope.currentMonth,$scope.day)
            });
            $scope.amount = 1;
            $scope.name = 'a';
            $scope.paid = false;
            $scope.day = new Date().getDate();
        }
        setCurrentRecords($scope, filter(addRecordFromPrevMonth(records,$scope.currentYear, $scope.currentMonth), $scope.currentYear, $scope.currentMonth), filter(groups, $scope.currentYear, $scope.currentMonth));
    }

    $scope.saveFromFroup = function (group) {
        var gs = $scope.name;
        records.push({
            amount: parseInt(group.recordAmount),
            name: group.recordName,
            paid: group.recordPaid,
            time: new Date($scope.currentYear,$scope.currentMonth,group.recordDay),
            groupId : group.id
        });
        group.recordAmount = 1;
        group.recordName = 'a';
        group.recordPaid = false;
        group.recordDay = new Date().getDate();
        setCurrentRecords($scope, filter(addRecordFromPrevMonth(records,$scope.currentYear, $scope.currentMonth), $scope.currentYear, $scope.currentMonth), filter(groups, $scope.currentYear, $scope.currentMonth));

    }
}
]);

var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "June",
    "July", "Aug", "Sepr", "Oct", "Nov", "Dec"
];

function addRecordFromPrevMonth(records,year,month) {
    var prevMonth = month-1;
    var prevYear = year;
    if(prevMonth < 0)
    {
        prevMonth = 11;
        prevYear = year-1;
    }
    var prevMonthRecords = filter(records,prevYear,prevMonth);
    var prevExpences = calculateExpences(prevMonthRecords);
    var prevCurrent = calculateCurrent(prevMonthRecords);
    var prevLeftAmount = prevCurrent - prevExpences;
    var result = [];
    for(var i = 0;i < records.length;i++)
    {
        result.push(records[i]);
    }
    result.push({
        amount: prevLeftAmount * -1,
        name: 'from ' + monthNames[prevMonth],
        paid: true,
        time: new Date(year,month,1),
    })

    return result;

}
function setCurrentRecords($scope, records, groups) {
    $scope.currentRecords = recordsWithoutGroups(records);
    $scope.currentGroups = assignRecordsIntoGroups(records, groups);
    $scope.expectedExpences = calculateExpences($scope.currentRecords);
    $scope.currentAmount = calculateCurrent($scope.currentRecords);
    $scope.leftAmount = $scope.currentAmount - $scope.expectedExpences;
}
function assignRecordsIntoGroups(records, groups) {
    var groupsDict = {};
    for (var i = 0; i < groups.length; i++) {
        groupsDict[groups[i].id] = groups[i];
        groups[i].records = [];
        groups[i].leftAmount = groups[i].amount;
        groups[i].recordDay = new Date().getDate();
    }
    var result = [];
    for (var i = 0; i < records.length; i++) {
        if (records[i].groupId > 0) {

            groupsDict[records[i].groupId].records.push(records[i]);
            if (records[i].paid)
                groupsDict[records[i].groupId].leftAmount -= records[i].amount;
        }
    }
    return groups;
}
function recordsWithoutGroups(records) {
    var result = [];
    for (var i = 0; i < records.length; i++) {
        if (!(records[i].groupId > 0))
            result.push(records[i]);
    }
    return result;
}
function calculateExpences(records) {
    var result = 0;
    for (var i = 0; i < records.length; i++) {
        if (!records[i].paid)
            result += records[i].amount;
    }
    return result;
}
function calculateCurrent(records) {
    var result = 0;
    for (var i = 0; i < records.length; i++) {
        if (records[i].paid)
            result += (-records[i].amount);
    }
    return result;
}
function removeItem(item, array) {
    var result = [];
    for (var i = 0; i < array.length; i++) {
        if (array[i] != item)
            result.push(array[i]);
    }
    return result;
}
function filter(records, year, month) {
    var result = [];
    for (var i = 0; i < records.length; i++) {
        if (records[i].time.getMonth() == month && records[i].time.getFullYear() == year)
            result.push(records[i]);
    }
    return result;
}


text:
BusEvents implementation base RxJava/RxAndroid/AndroidInject.
## Dependencies:

[AndroidBucket](https://github.com/wangjiegulu/AndroidBucket):My base library

[AndroidInject](https://github.com/wangjiegulu/androidInject):My Inject library

[RxJava](https://github.com/ReactiveX/RxJava)

[RxAndroid](https://github.com/ReactiveX/RxAndroid)

[retrolambda](https://github.com/evant/gradle-retrolambda)

## How to use with Annotation(recommended)
`It's realy simple to use with annotation`
### 1. You must be config presents to support annotations(For example: BaseActivity which extends AIAppCompatActivity in the [AndroidInject](https://github.com/wangjiegulu/androidInject) library)
```java
private RxBusAnnotationManager rxBusAnnotationManager;
@Override
public void parserMethodAnnotations(Method method) throws Exception {
    if (method.isAnnotationPresent(Accept.class)) {
        if (null == rxBusAnnotationManager) {
            rxBusAnnotationManager = new RxBusAnnotationManager(this);
        }
        rxBusAnnotationManager.parserObservableEventAnnotations(method);
    }
}

@Override
protected void onDestroy() {
    super.onDestroy();
    if (null != rxBusAnnotationManager) {
        rxBusAnnotationManager.clear();
    }
}
```
### 2. Write a method in your present(eg. your activity), and use an @Accept annotation
```java
@Accept
public void onPostAccept(Object tag, AddFeedsEvent event) {
    // todo: Accept event and process here (in main thread)
}
```
or
```java
@Accept(
            acceptScheduler = AcceptScheduler.NEW_THREAD,
            value = {
                    @AcceptType(tag = ActionEvent.CLOSE, clazz = String.class),
                    @AcceptType(tag = ActionEvent.BACK, clazz = String.class),
                    @AcceptType(tag = ActionEvent.EDIT, clazz = String.class),
                    @AcceptType(tag = ActionEvent.REFRESH, clazz = String.class)
            }
    )
    public void onPostAccept(Object tag, Object actionEvent) {
        Logger.d(TAG, "[ActionEvent]onPostAccept action event name: " + actionEvent);
        // todo: Accept event and process here (in new thread)
    }
```

@Accept:
```
acceptScheduler: Perform this method on a specified scheduler;
value[]: AcceptType annotation array that specify the types this method can be accept.
```
@AcceptType:
```
tag: The tag of the event.
clazz: The Class of the event.
```

### 3. Post a event any where:
```java
AddFeedsEvent addFeedsEvent = new AddFeedsEvent();
// Construct a AddFeedsEvent Object...
RxBus.get().post(addFeedsEvent);
```

### 4. Specify an Executor or Handler(Optional)
```java
public class MyApplication extends Application {
    private Executor acceptExecutor = Executors.newCachedThreadPool();
    private Handler handler = new Handler(Looper.getMainLooper());

    @Override
    public void onCreate() {
        super.onCreate();
        DefaultAcceptConfiguration.getInstance().registerAcceptConfiguration(new DefaultAcceptConfiguration.OnDefaultAcceptConfiguration() {
            @Override
            public Executor applyAcceptExecutor() {
                return acceptExecutor;
            }

            @Override
            public Handler applyAcceptHandler() {
                return handler;
            }
        });
    }
}
```

## How to use without Annotation(Not recommended)
### Register an Observer
```java
Observable<String> addOb = RxBus.get()
                .register("addFeedTag", String.class);

addOb.observeOn(AndroidSchedulers.mainThread())
                .subscribe(s -> {
                    // todo: Accept event and process here
                });
```
### Post a event any where
```java
RxBus.get().post("addFeedTag", "hello RxBus!");
```
### unregister the Observer
```java
RxBus.get().unregister("addFeedTag", addOb);
```

License
=======

    Copyright 2015 Wang Jie

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.


text:
package com.hdc.model;

import java.util.Date;

import com.hdc.util.Constant;

public class LoginLog {
	private String tableName = Constant.LOGIN_LOG;
	private Integer id;
	private Date createDate;
	private String wangwangId;
	private String contact;
	private String ip;
	private String loginAddress;

	private String startDate;
	private String endDate;

	//--辅助字段
	private String realAddress;
	public String getTableName() {
		return tableName;
	}
	public void setTableName(String tableName) {
		this.tableName = tableName;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	public String getWangwangId() {
		return wangwangId;
	}
	public void setWangwangId(String wangwangId) {
		this.wangwangId = wangwangId;
	}
	public String getIp() {
		return ip;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
	public String getContact() {
		return contact;
	}
	public void setContact(String contact) {
		this.contact = contact;
	}
	public String getStartDate() {
		return startDate;
	}
	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}
	public String getEndDate() {
		return endDate;
	}
	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}
	public String getLoginAddress() {
		return loginAddress;
	}
	public void setLoginAddress(String loginAddress) {
		this.loginAddress = loginAddress;
	}
	public String getRealAddress() {
		return realAddress;
	}
	public void setRealAddress(String realAddress) {
		this.realAddress = realAddress;
	}

}


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>Vortex OpenSplice - documentation index</title>

    <link rel="stylesheet" href="./docs/css/print.css" type="text/css" media="print" />
    <meta name="Date-Revision-yyyymmdd" content="20141002" />
    <meta http-equiv="Content-Language" content="en" />

          ADLINK on the Web: http://ist.adlinktech.com/
          | Vortex OpenSplice

Vortex OpenSplice

            Introduction

              User Guides

              Changes

              Supported Platforms

              Known Issues

              DDSI Release Notes

               Rebuilding the APIs

               Upgrading OpenSplice

               Examples

               Third party licenses

              License

 Introduction

 These notes document the current state of release of the OpenSplice DDSI2 Service.
The DDSI2 service is an implementation of the OMG DDSI 2.1 specification for
Vortex OpenSplice.

 There is a solid body of evidence that there is real interoperability between
OpenSplice and other vendors' implementations, and in particular with RTI DDS.
Nevertheless, there are still some areas that have seen minimal interoperability
testing at best. We kindly invite anyone running into interoperability issues to
contact us, either via the OpenSplice forum,
or, for our commercial customers, via our support channels.

 Those interested in testing interoperability by running the same applications
used at the "OMG Interoperability Demonstrations" can download the
full package here.

 Limitations

 Please note that this section may not be exhaustive.

 For an overview of QoS settings, see QoS compliancy.

 QoS changes are not supported.

 Limited influence on congestion-control behaviour.

 If DDSI2 is operated in its default mode where each participant has its
           own UDP/IP port number, the maximum number of participants on a node serviced
           by an instance of the DDSI2 service is limited to approximately 60, exceeding
           this limit will cause the DDSI2 service to abort. It appears this mode
           is only required for interoperability with TwinOaks CoreDX DDS. There
           is never a limit on the number of remote participants.

 No support for inlining QoS settings yet. DataReaders requesting inlined
           QoS will be ignored.

 Running DDSI2 in parallel to the native networking may impact the
           performance of the native networking even when DDSI2 is not actually
           involved in the transmission of data, as DDSI2 still performs some
           processing on the data.

 No more than 32 key fields, and the concatenated key fields may not
           require more than 32 bytes of storage, where strings count for 4
           bytes.

 When multicast is enabled and a participant is discovered that
           advertises a multicast address, it is assumed to be reachable via that
           multicast address. If it is not, then it must currently be operated in
           multicast-disabled mode with all possible peer nodes listed explicitly,
           as this will restrict the set of addresses advertised by the
           participant to its unicast address.

 QoS compliancy

 The following table lists the level of support for each QoS. In some cases,
compliancy is better when the DDSI2 service is used to connect two OpenSplice
nodes than when it used to connect an OpenSplice node with another vendor's DDS
implementation. The OpenSplice kernel performs many aspects of DDS in ways
independent of the underlying wire protocol, but interoperating with another
vendor's DDS implementation requires the DDSI2 service to fully implement the
mapping prescribed by the DDSI 2.1 specification. This work has not been completed
yet.

  QoS 	                    OpenSplice 	     Other vendor

  USER_DATA 	              Compliant 	      Compliant

  TOPIC_DATA 	             Compliant 	      Compliant

  GROUP_DATA 	             Compliant 	      Compliant

     DURABILITY
     Compliant, but see Issues rooted in the standard

  DURABILITY_SERVICE 	     Compliant 	      Compliant

  PRESENTATION 	           Compliant
     Compliant, access scope GROUP extensions not yet defined in the standard.

  DEADLINE 	               Compliant 	      Compliant

  LATENCY_BUDGET 	         Compliant 	      Compliant

  OWNERSHIP 	              Compliant 	      Shared ownership:
  fully supported; exclusive ownership: partially supported, a higher-strength writer
  can take ownership but failover to a lower-strength one may not occur.

  OWNERSHIP_STRENGTH 	     Compliant 	      Compliant

     LIVELINESS
     Compliant
     All entities treated as if liveliness is AUTOMATIC. For OpenSplice participants,
    the lease duration is fixed at 11s, for readers and writers at infinity. Lease
    durations of remote participants, readers and writers are honoured correctly.

     TIME_BASED_FILTER
     Compliant, except that all there is no filtering to limit the
    rate with which samples are delivered to the reader.

  PARTITION 	              Compliant 	      Compliant

  RELIABILITY 	            Compliant 	      Compliant

  TRANSPORT_PRIORITY 	     Compliant 	      Compliant

  LIFESPAN 	               Compliant 	      Compliant

  DESTINATION_ORDER 	      Compliant 	      Compliant

     HISTORY
     Compliant, except that the writer history for a DataWriter of
    transient-local durability is always maintained as if the history setting is KEEP_LAST with depth 1

  RESOURCE_LIMITS 	        Compliant 	      Compliant

  ENTITY_FACTORY 	         Compliant 	      Compliant

  WRITER_DATA_LIFECYCLE 	  Compliant 	      Compliant

  READER_DATA_LIFECYCLE 	  Compliant 	      Compliant

 Issues rooted in the standard

 The specification only deals with volatile and transient-local data,
  and leaves the behaviour for transient and persistent data undefined. Many
  OpenSplice applications follow the recommendation to use transient data and not
  transient-local data, and indeed, OpenSplice implements transient-local as
  transient. This evidently creates a complex situation for a DDSI implementation.

 The following two tables aim to provide an overview of the expected behaviour
   when both sides are using OpenSplice, and when only one side is.

 OpenSplice writer:

  Writer QoS 	  Reader QoS 	  Behaviour

  all 	  volatile 	  as expected

  transient-local 	  transient-local 	  DDSI2 will
    internally manage a writer history cache containing the historical data for a
    history setting of KEEP_LAST with depth 1 (note that this is the default for
    writers). The data will be advertised in accordance with the specification
    and new readers receive the old data upon request. An OpenSplice reader will
    also receive the data maintained by the OpenSplice durability service.

  transient 	  transient-local 	  A remote
    reader on OpenSplice will receive transient data from the OpenSplice durability
    service, but a remote reader on another vendor's implementation will not.

  transient 	  same as previous case

  persistent 	  all 	  deviations from the
    expected behaviour are the same as for transient

 Non-OpenSplice writer, OpenSplice reader:

  Writer QoS 	  Reader QoS 	  Behaviour

  all 	  volatile 	  as expected

  transient-local 	  transient-local 	  The reader will request historical data from the writer, and will in addition receive whatever data is stored by the OpenSplice durability service.

  transient 	  transient-local 	  The reader may or may not receive transient data from the remote system, depending on the remote implementation. It will receive data from the OpenSplice durability service. The durability service will commence storing data when the first reader or writer for that topic/partition combination is created by any OpenSplice participant (i.e., it is immaterial on which node).

  transient 	  same as previous case

  persistent 	  all 	  deviations from the expected behaviour are the same as for transient

 Once the specification is extended to cover transient data, the situation will
  become much more straightforward. In the meantime it may be possible to make more
  configurations work as expected. The specification process is currently actively
  exploring the alternatives.

 No verification of topic consistency between OpenSplice and other vendors'
  implementations. The specification leaves this undefined. OpenSplice-to-OpenSplice
  the kernel will detect inconsistencies.

 DDSI2 uses a shared set of discovered participants,
  readers and writers on a single node. Consequently, a new OpenSplice participant
  learns of the readers and writers of remote participants and starts communicating
  with them, even before the remote participant has had a chance of discovering this
  new participant. This behaviour is believed to be allowed by the specification, but
  one other implementation has at one point been observed to malfunction because of this.

 The specification of the format of a KeyHash is ambiguous, in that one
  can argue whether or not padding should be used within a KeyHash to align the
  fields to their natural boundaries. The DDSI2 service currently does not insert
  padding, as this has the benefit of allowing more complex keys to be packed into
  the fixed-length key hash. It may be that this is not the intended interpretation.

Notes on DDSI2E support for SSM

Configurable mapping of partition/topic combinations to SSM, using
    the network partition mechanism. Until now, the writers would simply publish
    to the addresses advertised by the readers, and the network partitions could
    be used to advertise an alternative (ASM) multicast address. In this
    prototype, the writers will look at the address set in the network
    partition, and if the set happens to include SSM addresses, it will include
    an arbitrarily selected SSM address in its discovery data. The presence of
    an SSM address in the writer's discovery data is taken by the readers as an
    indication that the writer is willing to serve data using SSM at that
    address. Analogously, the readers will also look at the address set in the
    network partition, and again, if it includes an SSM address, it will
    advertise that it favours SSM over ASM. (Note that it favours SSM, not that
    it requires it.) If an SSM-favouring reader discovers an SSM-capable writer,
    DDSI2E on the reader side will join the writer's advertised SSM group.
    An SSM-capable writer will preferentially use unicast, but if it decides to
    use multicasting, it will include its SSM address if there is an
    SSM-favouring reader. If there is a mixture of SSM-favouring and
    non-SSM-favouring readers, and the SSM-favouring readers have also joined
    one or more of the (ASM) multicast groups, they will currently receive the
    data over both channels. The mappings need not be the same on all machines.
    Note that SSM addresses are in the 232.x.y.z range for IPv4 and
    ff3x::4000:1 to ff3x::ffff:ffff range for IPv6, according to RFC 4607
    (but really ff3x::8000:0 onwards, as the lower half of the range is reserved
    for allocation by IANA). This is also the criterion used by DDSI2E to
    determine whether or not to use SSM.

Possibility of running without ASM but with SSM
    There are really three categories of data in DDSI:

application data

participant discovery (SPDP) data

endpoint discovery (SEDP) data

    Application data is primarily covered by point 1 above. The SPDP data has to
    use ASM or unicast — it is used to discover who is out there, so SSM is an
    obvious impossibility. This has not changed. SEDP (as well as any
    application data not mapped to a network partition) relies on the default
    addresses advertised in the SPDP messages. To allow use of SSM for SEDP,
    this version adds the option of independently setting the SPDP address and
    those advertised default addresses, with the latter defaulting to the SPDP
    address. If this default address is an SSM address, any reader or writer
    relying on the default address will use SSM, as if it were mapped to a
    networking partition specifying the use of SSM, as in point 1. Note that
    there is no need for the default address to be different from any of the
    other addresses. Now that DDSI2E supports two types of multicast, a simple
    boolean switch "AllowMulticasting" is no longer sufficient. DDSI2E now
    interprets this as a comma-separated list of the keywords: "spdp", "asm" and
    "ssm". The first enables use of ASM for SPDP only, the others simply enable
    full use of ASM and SSM, respectively. The old "true" enables all types of
    multicasting, and "false" disables it altogether.

Example - The following basic configuration will rely on ASM for SPDP
    and on SSM using group address 232.3.1.3 for all SEDP and user data not in
    DCPS partition A; and on SSM using group address 232.3.1.4 for all user data
    in DCPS partition A.

<DDSI2EService name="ddsi2e">
    <Discovery>
        <DefaultMulticastAddress>232.3.1.3</DefaultMulticastAddress>
    </Discovery>
    <!-- this ensures that readers for data in partitions A and B will favour
    SSM, and that writers for data in partitions A and B will provide data via
    SSM, via addresses 232.3.1.4 and 232.3.1.5, respectively -->
    <Partitioning>
        <NetworkPartitions>
            <NetworkPartition name="ssmA" address="232.3.1.4"/>
        &lt/NetworkPartitions>
        &ltPartitionMappings>
            &ltPartitionMapping DCPSPartitionTopic="A.*" NetworkPartition="ssmA" />
        &lt/PartitionMappings>
    &lt/Partitioning>
&lt/DDSI2EService>

       Copyright © 2017 ADLINK. All Rights Reserved.


text:
djangocms-text-mediumeditor
===========================

Text plugin for [Django CMS][0] which uses [MediumEditor][1] instead of
CKEditor.

Current bundled version of MediumEditor is **5.23.3**.

[0]: https://www.django-cms.org
[1]: https://yabwe.github.io/medium-editor/


text:
package com.ricardo.casarez.flighsearch.data.entities.wrappers;

import com.ricardo.casarez.flighsearch.domain.entity.search.request.SearchRequest;

/**
 * Class that models search request.
 * @Link https://developers.google.com/qpx-express/v1/trips/search#http-request
 * Created by Ricardo Casarez on 10/25/16.
 */
public class SearchRequestWrapper {
    private SearchRequest request;

    public SearchRequestWrapper() {

    }

    public SearchRequestWrapper(SearchRequest searchRequest) {
        request = searchRequest;
    }

    public SearchRequest getRequest() {
        return request;
    }

    public void setRequest(SearchRequest request) {
        this.request = request;
    }
}


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

    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>statsmodels.regression.linear_model.GLS.fit_regularized — statsmodels 0.9.0 documentation</title>
    <link rel="stylesheet" href="../_static/nature.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="shortcut icon" href="../_static/statsmodels_hybi_favico.ico"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="statsmodels.regression.linear_model.GLS.from_formula" href="statsmodels.regression.linear_model.GLS.from_formula.html" />
    <link rel="prev" title="statsmodels.regression.linear_model.GLS.fit" href="statsmodels.regression.linear_model.GLS.fit.html" />
<link rel="stylesheet" href="../_static/examples.css" type="text/css" />
<link rel="stylesheet" href="../_static/facebox.css" type="text/css" />

Navigation

          index

          modules |

          next |

          previous |

Install
  |

Support
  |

Bugs
  |

Develop
  |

Examples
  |

FAQ
  |

Linear Regression |

statsmodels.regression.linear_model.GLS |

statsmodels.regression.linear_model.GLS.fit_regularized¶

GLS.fit_regularized(method='elastic_net', alpha=0.0, L1_wt=1.0, start_params=None, profile_scale=False, refit=False, **kwargs)[source]¶

Return a regularized fit to a linear regression model.

<col class="field-name" />
<col class="field-body" />

Parameters:

method (string) – Only the 'elastic_net' approach is currently implemented.

alpha (scalar or array-like) – The penalty weight.  If a scalar, the same penalty weight
applies to all variables in the model.  If a vector, it
must have the same length as params, and contains a
penalty weight for each coefficient.

L1_wt (scalar) – The fraction of the penalty given to the L1 penalty term.
Must be between 0 and 1 (inclusive).  If 0, the fit is a
ridge fit, if 1 it is a lasso fit.

start_params (array-like) – Starting values for params.

profile_scale (bool) – If True the penalized fit is computed using the profile
(concentrated) log-likelihood for the Gaussian model.
Otherwise the fit uses the residual sum of squares.

refit (bool) – If True, the model is refit using only the variables that
have non-zero coefficients in the regularized fit.  The
refitted model is not regularized.

distributed (bool) – If True, the model uses distributed methods for fitting,
will raise an error if True and partitions is None.

generator (function) – generator used to partition the model, allows for handling
of out of memory/parallel computing.

partitions (scalar) – The number of partitions desired for the distributed
estimation.

threshold (scalar or array-like) – The threshold below which coefficients are zeroed out,
only used for distributed estimation

Returns:

Return type:
A RegularizedResults instance.

Notes

The elastic net approach closely follows that implemented in
the glmnet package in R.  The penalty is a combination of L1
and L2 penalties.

The function that is minimized is:

\[0.5*RSS/n + alpha*((1-L1\_wt)*|params|_2^2/2 + L1\_wt*|params|_1)\]

where RSS is the usual regression sum of squares, n is the
sample size, and \(|*|_1\) and \(|*|_2\) are the L1 and L2
norms.

For WLS and GLS, the RSS is calculated using the whitened endog and
exog data.

Post-estimation results are based on the same data used to
select variables, hence may be subject to overfitting biases.

The elastic_net method uses the following keyword arguments:

maxiter : int

Maximum number of iterations

cnvrg_tol : float

Convergence threshold for line searches

zero_tol : float

Coefficients below this threshold are treated as zero.

References

Friedman, Hastie, Tibshirani (2008).  Regularization paths for
generalized linear models via coordinate descent.  Journal of
Statistical Software 33(1), 1-22 Feb 2010.

Previous topic

statsmodels.regression.linear_model.GLS.fit

Next topic

statsmodels.regression.linear_model.GLS.from_formula

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

        © Copyright 2009-2017, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
      Created using Sphinx 1.7.4.


text:
table#checklist tbody tr:nth-child(odd) {
    background: #ece;
}

table#checklist tbody tr:nth-child(even) {
    background: #cee;
}

table#checklist td {
    padding: 5px;
}

table#checklist td.description {
    vertical-align: middle;
}

table#checklist button.remove-item,button.check {
    font-size: 30px;
}

table#checklist td#remove-item-placeholder {
    width: 30px;
}

table#checklist button#new-item {
    font-size: 30px;
}


text:
using System;
using System.Collections.Generic;
using System.Text;

namespace SwitchAppDesign.AniListAPI.v2.Common
{
    /// <inheritdoc />
    /// <summary>
    /// Exception thrown when a graph query argument is in an invalid state according to its associated rules.
    /// </summary>
    public class GraphQueryArgumentInvalidException : ArgumentException
    {
        public GraphQueryArgumentInvalidException() { }

        public GraphQueryArgumentInvalidException(string message) : base(message) { }

        public GraphQueryArgumentInvalidException(string message, string propertyName) : base(message, propertyName) { }
    }

    /// <inheritdoc />
    /// <summary>
    /// Exception thrown when a graph query argument is in an invalid state according to its associated rules.
    /// </summary>
    public class GraphQueryFieldInvalidException : ArgumentException
    {
        public GraphQueryFieldInvalidException() { }

        public GraphQueryFieldInvalidException(string message) : base(message) { }

        public GraphQueryFieldInvalidException(string message, string propertyName) : base(message, propertyName) { }
    }
}


text:
import { editor } from 'monaco-editor';
import { SiteSettings } from './settings';

export type Themes = 'default' | 'dark' | 'darkplus';

export interface Theme {
    path: string;
    id: string;
    name: string;
    mainColor: string;
    monaco: string;
}

export const themes: Record<Themes, Theme> = {
    default: {
        path: 'default',
        id: 'default',
        name: 'Light',
        mainColor: '#f2f2f2',
        monaco: 'ce',
    },
    dark: {
        path: 'dark',
        id: 'dark',
        name: 'Dark',
        mainColor: '#333333',
        monaco: 'ce-dark',
    },
    darkplus: {
        path: 'dark',
        id: 'darkplus',
        name: 'Dark+',
        mainColor: '#333333',
        monaco: 'ce-dark-plus',
    },
};

editor.defineTheme('ce', {
    base: 'vs',
    inherit: true,
    rules: [
        {token: 'identifier.definition.cppx-blue', foreground: '008a00', fontStyle: 'bold'},
    ],
    colors: {},
});

editor.defineTheme('ce-dark', {
    base: 'vs-dark',
    inherit: true,
    rules: [
        {token: 'identifier.definition.cppx-blue', foreground: '7c9c7c', fontStyle: 'bold'},
    ],
    colors: {},
});

editor.defineTheme('ce-dark-plus', {
    base: 'vs-dark',
    inherit: true,
    rules: [
        {token: 'identifier.definition.cppx-blue', foreground: '7c9c7c', fontStyle: 'bold'},
        {token: 'keyword.if.cpp', foreground: 'c586c0'},
        {token: 'keyword.else.cpp', foreground: 'c586c0'},
        {token: 'keyword.while.cpp', foreground: 'c586c0'},
        {token: 'keyword.for.cpp', foreground: 'c586c0'},
        {token: 'keyword.return.cpp', foreground: 'c586c0'},
        {token: 'keyword.break.cpp', foreground: 'c586c0'},
        {token: 'keyword.continue.cpp', foreground: 'c586c0'},
        {token: 'keyword.goto.cpp', foreground: 'c586c0'},
        {token: 'keyword.directive.cpp', foreground: 'c586c0'},
        {token: 'keyword.directive.include.cpp', foreground: 'c586c0'},
        {token: 'keyword.directive.include.begin.cpp', foreground: 'ce9178'},
        {token: 'keyword.directive.include.end.cpp', foreground: 'ce9178'},
        {token: 'keyword.new.cpp', foreground: 'c586c0'},
        {token: 'keyword.using.cpp', foreground: 'c586c0'},
        {token: 'string.escape.cpp', foreground: 'd7ba7d'},
    ],
    colors: {},
});

export class Themer {
    private currentTheme: Theme | null = null;

    constructor(private eventHub: any, initialSettings: SiteSettings) {
        this.onSettingsChange(initialSettings);

        this.eventHub.on('settingsChange', this.onSettingsChange, this);

        this.eventHub.on('requestTheme', () => {
            this.eventHub.emit('themeChange', this.currentTheme);
        }, this);
    }

    public setTheme(theme: Theme) {
        if (this.currentTheme === theme) return;
        $('html').attr('data-theme', theme.path);
        $('#meta-theme').prop('content', theme.mainColor);
        editor.setTheme(theme.monaco);
        this.eventHub.emit('resize');
        this.currentTheme = theme;
    }

    private onSettingsChange(newSettings: SiteSettings) {
        const newTheme = themes[newSettings.theme] || themes.default;
        if (!newTheme.monaco)
            newTheme.monaco = 'vs';
        this.setTheme(newTheme);
    }
}


text:
Always prefer the functionality built into Java in favor of Apache Commons/Lang/Codec etc.

You can check the effective dependency tree:
mvn dependency:tree -Dscope=compile

### Add a license header for each file

mvn license:update-file-header

### Keep 3rd party licenses file updated

If you add or remove dependencies then don't forget to run

mvn license:add-third-party

to update the file: LICENSE.3RD-PARTY


text:
<template name="GameDashboard">
  {{> logout}}
  {{#if gameReady}}

{{perkIcon}}

          {{#unless gameOver}}

            {{#if inNode}}

              flash_on
              {{#if isMedic}}

              {{/if}}

            {{/if}}

            {{#if inBase}}

              directions_run
              favorite
              fitness_center

            {{/if}}

            {{#if inOpponentBase}}

              flash_on

            {{/if}}

          {{else}}

{{winner}} wins!

          {{/unless}}

  {{else}}

Waiting for players to join...

  {{/if}}
</template>


text:
import { applyMiddleware, compose, createStore } from 'redux';
import thunkMiddleware from 'redux-thunk';

import rootReducer from './reducers';

export default () => {
  const storeCreator =
    process.env.NODE_ENV === 'development'
      ? compose(
          // eslint-disable-next-line global-require
          applyMiddleware(thunkMiddleware, require('redux-logger').logger),
        )(createStore)
      : compose(applyMiddleware(thunkMiddleware))(createStore);

  return storeCreator(rootReducer, {});
};


text:
package sample.profile;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import sample.profile.service.MessageService;

@SpringBootApplication
public class SampleProfileApplication implements CommandLineRunner {

	// Simple example shows how a command line spring application can execute an
	// injected bean service. Also demonstrates how you can use @Value to inject
	// command line args ('--name=whatever') or application properties

	@Autowired
	private MessageService helloWorldService;

	@Override
	public void run(String... args) {
		System.out.println(this.helloWorldService.getMessage());
	}

	public static void main(String[] args) throws Exception {
		SpringApplication.run(SampleProfileApplication.class, args);
	}
}


text:
@interface QSEpiInfoService() <MSFilter>

@property (nonatomic, strong)   MSTable *table;
@property (nonatomic)           NSInteger busyCount;

@end

#pragma mark * Implementation

@implementation QSEpiInfoService

@synthesize items;
@synthesize applicationURL = _applicationURL;
@synthesize applicationKey = _applicationKey;

- (NSString *)applicationKey
{
    return _applicationKey;
}
- (void)setApplicationKey:(NSString *)applicationKey
{
    _applicationKey = applicationKey;
}

- (void)setTableName:(NSString *)tableName
{
    self.table = [_client tableWithName:tableName];
}

+ (QSEpiInfoService *)defaultService
{
    // Create a singleton instance of QSTodoService
    static QSEpiInfoService* service;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        service = [[QSEpiInfoService alloc] init];
    });

    return service;
}

-(QSEpiInfoService *)init
{
    self = [super init];

    if (self)
    {
        // Initialize the Mobile Service client with your URL and key
//        MSClient *client = [MSClient clientWithApplicationURLString:@"https://epiinfozfj4.azure-mobile.net/"
//                                                     applicationKey:@"IOPLzOGviMqmZGNuJtOyMZigpxzkRv87"];
        MSClient *client = [MSClient clientWithApplicationURLString:self.applicationURL
                                                     applicationKey:self.applicationKey];

        // Add a Mobile Service filter to enable the busy indicator
        self.client = [client clientWithFilter:self];

        // Create an MSTable instance to allow us to work with the TodoItem table
        //        self.table = [_client tableWithName:@"SampleTodoAppTable"];
//        self.table = [_client tableWithName:@"TestTable0"];

        self.items = [[NSMutableArray alloc] init];
        self.busyCount = 0;
    }

    return self;
}

-(QSEpiInfoService *)initWithURL:(NSString *)url AndKey:(NSString *)key
{
    self = [super init];

    if (self)
    {
        // Initialize the Mobile Service client with your URL and key
        //        MSClient *client = [MSClient clientWithApplicationURLString:@"https://epiinfozfj4.azure-mobile.net/"
        //                                                     applicationKey:@"IOPLzOGviMqmZGNuJtOyMZigpxzkRv87"];
        MSClient *client = [MSClient clientWithApplicationURLString:url
                                                     applicationKey:key];

        // Add a Mobile Service filter to enable the busy indicator
        self.client = [client clientWithFilter:self];

        // Create an MSTable instance to allow us to work with the TodoItem table
        //        self.table = [_client tableWithName:@"SampleTodoAppTable"];
        //        self.table = [_client tableWithName:@"TestTable0"];

        self.items = [[NSMutableArray alloc] init];
        self.busyCount = 0;
    }
    return self;
}

- (void)refreshDataOnSuccess:(QSCompletionBlock)completion
{
    // Create a predicate that finds items where complete is false
    NSPredicate * predicate = [NSPredicate predicateWithFormat:@"complete == NO"];

    // Query the TodoItem table and update the items property with the results from the service
    [self.table readWithPredicate:predicate completion:^(NSArray *results, NSInteger totalCount, NSError *error)
     {
         [self logErrorIfNotNil:error];

         items = [results mutableCopy];

         // Let the caller know that we finished
         completion();
     }];

}

-(void)addItem:(NSDictionary *)item completion:(QSCompletionWithIndexBlock)completion
{
    // Check whether id is already in table before inserting
    [self.table readWithId:[item objectForKey:@"id"] completion:^(NSDictionary *readItem, NSError *error) {
//        NSLog(@"Read count: %d", readItem.count);
        // Insert the item into the TodoItem table and add to the items array on completion
        if (readItem.count == 0)
        {
            [self.table insert:item completion:^(NSDictionary *result, NSError *error)
             {
                 [self logErrorIfNotNil:error];

                 NSUInteger index = [items count];

                 if (error)
                     index = -1;
                 else
                     [(NSMutableArray *)items insertObject:result atIndex:index];

                 // Let the caller know that we finished
                 completion(index);
             }];
        }
        else
        {
            [self.table update:item completion:^(NSDictionary *result, NSError *error) {
                [self logErrorIfNotNil:error];

                NSUInteger index = [items count];

                if (error)
                    index = -1;
                else
                    [(NSMutableArray *)items insertObject:result atIndex:index];

                completion(index);
            }];
        }
    }];
}

-(void)deleteItem:(NSDictionary *)item completion:(QSCompletionWithIndexBlock)completion
{
    // Check whether id is already in table before inserting
    [self.table readWithId:[item objectForKey:@"id"] completion:^(NSDictionary *readItem, NSError *error) {
        //        NSLog(@"Read count: %d", readItem.count);
        // Insert the item into the TodoItem table and add to the items array on completion
        if (readItem.count == 0)
        {
            [self.table delete:item completion:^(NSDictionary *result, NSError *error)
             {
                 [self logErrorIfNotNil:error];

                 NSUInteger index = [items count];

                 if (error)
                     index = -1;
                 else
                     [(NSMutableArray *)items insertObject:result atIndex:index];

                 // Let the caller know that we finished
                 completion(index);
             }];
        }
        else
            completion(-1);
    }];
}

-(void)completeItem:(NSDictionary *)item completion:(QSCompletionWithIndexBlock)completion
{
    // Cast the public items property to the mutable type (it was created as mutable)
    NSMutableArray *mutableItems = (NSMutableArray *) items;

    // Set the item to be complete (we need a mutable copy)
    NSMutableDictionary *mutable = [item mutableCopy];
    [mutable setObject:@YES forKey:@"complete"];

    // Replace the original in the items array
    NSUInteger index = [items indexOfObjectIdenticalTo:item];
    [mutableItems replaceObjectAtIndex:index withObject:mutable];

    // Update the item in the TodoItem table and remove from the items array on completion
    [self.table update:mutable completion:^(NSDictionary *item, NSError *error) {

        [self logErrorIfNotNil:error];

        NSUInteger index = [items indexOfObjectIdenticalTo:mutable];
        if (index != NSNotFound)
        {
            [mutableItems removeObjectAtIndex:index];
        }

        // Let the caller know that we have finished
        completion(index);
    }];
}

- (void)busy:(BOOL)busy
{
    // assumes always executes on UI thread
    if (busy)
    {
        if (self.busyCount == 0 && self.busyUpdate != nil)
        {
            self.busyUpdate(YES);
        }
        self.busyCount ++;
    }
    else
    {
        if (self.busyCount == 1 && self.busyUpdate != nil)
        {
            self.busyUpdate(FALSE);
        }
        self.busyCount--;
    }
}

- (void)logErrorIfNotNil:(NSError *) error
{
    if (error)
    {
        NSLog(@"ERROR %@", error);
    }
}

#pragma mark * MSFilter methods

- (void)handleRequest:(NSURLRequest *)request
                 next:(MSFilterNextBlock)next
             response:(MSFilterResponseBlock)response
{
    // A wrapped response block that decrements the busy counter
    MSFilterResponseBlock wrappedResponse = ^(NSHTTPURLResponse *innerResponse, NSData *data, NSError *error)
    {
        [self busy:NO];
        response(innerResponse, data, error);
    };

    // Increment the busy counter before sending the request
    [self busy:YES];
    next(request, wrappedResponse);
}

@end


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

var mercury = require('mercury');
var insertCss = require('insert-css');

var Sidebar = require('../sidebar/index');
var MainContent = require('../main-content/index');
var ReportBug = require('../bug-report/index');
var UserAccount = require('../user-account/index');

var css = require('./index.css');

var h = mercury.h;

module.exports = create;
module.exports.render = render;
module.exports.setSplashMessage = setSplashMessage;

/*
 * Page level layout of the application
 */
function create() {

  var state = mercury.varhash({
    /*
     * Whether the sidebar drawer is visible
     * @type {boolean}
     */
    sidebarOpened: mercury.value(false),

    /*
     * Title text to display in the toolbar
     * @type {string}
     */
    title: mercury.value(''),

    /*
     * Toast messages to display
     * @type {Array<Object>}
     */
    toasts: mercury.array([])
  });

  var events = mercury.input([
    'openSidebar',
    'closeSidebar',
    'deferRemoveToast',
  ]);

  wireUpEvents(state, events);

  return {
    state: state,
    events: events
  };
}

/*
 * Draw the full page of the application, which consists of a sidebar and main
 * panel. The sidebar is usually hidden but acts as a selector for the content
 * shown in the main panel. This content is rendered in the full browser window.
 *
 * See @app.js for the state definition. See @sidebar/index.js and
 * @main-content/index.js for their rendering functions.
 */
function render(state, events) {

  if (!state.initialized) {
    return h('div');
  } else {
    removeSplashScreen();
  }

  insertCss(css);

  if (!state.navigation.pageKey) {
    return mercury.h('paper-spinner', {
      attributes: {
        'active': true,
        'aria-label': 'Loading'
      }
    });
  }

  var panelAttributes = {
    attributes: {
      // Keep the drawer collapsed for any width size
      'responsiveWidth': '10000px',
      'selected': state.viewport.sidebarOpened ? 'drawer' : 'main'
    },
    // If drawer is open, clicking anywhere should close it
    'ev-click': (state.viewport.sidebarOpened ?
      mercury.event(events.viewport.closeSidebar) : null),
  };
  return h('core-drawer-panel.panel', panelAttributes, [
    h('core-header-panel.drawer', {
      attributes: {
        'drawer': true
      }
    }, [
      renderSideToolbar(state, events),
      Sidebar.render(state, events)
    ]),
    h('core-header-panel.main', {
      attributes: {
        'main': true
      }
    }, [
      renderMainToolbar(state, events),
      MainContent.render(state, events),
      renderToasts(state, events),
      ReportBug.render()
    ])
  ]);
}

/*
 * The title of the sidebar.
 */
function renderSideToolbar(state, events) {
  return h('core-toolbar.toolbar', [
    h('h1.title', 'Vanadium Namespace Browser')
  ]);
}

/*
 * The title of the main content.
 */
function renderMainToolbar(state, events) {
  return h('core-toolbar.toolbar', [
    h('paper-icon-button.drawer-toggle', {
      attributes: {
        'icon': 'menu'
      },
      'id': 'drawerToggle',
      'ev-click': mercury.event(events.viewport.openSidebar)
    }),
    h('h2.title', state.viewport.title),
    MainContent.renderHeader(state, events),
    UserAccount.render(state.userAccount)
  ]);
}

/*
 * Draws all the toasts stored in the state. Old toasts remain hidden.
 *
 * TODO(alexfandrianto): In order to limit mercury state, we attempt to purge
 * state.viewport.toasts. core-overlay-close-completed isn't always fired if
 * too many occur in the same time range, so setTimeout upon core-overlay-open-
 * completed works to solve that.
 * TODO(alexfandrianto): Try to get autoCloseDisabled accepted by Polymer so
 * that the paper-toast behavior is more consistent.
 */
function renderToasts(state, events) {
  return h('div.toasts', state.viewport.toasts.map(function(toast) {
    return renderToast(toast, events);
  }));
}

/*
 * Draws a short duration toast to inform the user.
 */
var toastDuration = 3000; // ms
function renderToast(toast, events) {
  // The toast type affects the css class
  var cssClass = toast.type || 'info';

  // If there is an event attached to the toast, draw it here.
  var children = [];
  if (toast.actionText) {
    children.push(h('div', {
      'ev-click': toast.action
    }, toast.actionText));
  }

  return h('paper-toast.' + cssClass, {
    'key': toast.key, // unique per toast => only drawn once
    attributes: {
      'text': toast.text,
      'opened': true,
      'duration': toastDuration,
      'autoCloseDisabled': true
    },
    // Clean up the old toasts after enough time has passed.
    'ev-core-overlay-open-completed': mercury.event(
      events.viewport.deferRemoveToast,
      toast.key
    )
  }, children);
}

/*
 * Wire up events that we know how to handle.
 */
function wireUpEvents(state, events) {
  events.openSidebar(function() {
    state.sidebarOpened.set(true);
  });
  events.closeSidebar(function() {
    state.sidebarOpened.set(false);
  });
  events.deferRemoveToast(function(key) {
    // Remove the toast after a reasonable delay.
    setTimeout(function() {
      // Filter out the toast whose key matches.
      state.put('toasts', state.toasts.filter(function(toast) {
        return toast.key !== key;
      }));
    }, toastDuration);
  });
}

/*
 * Removes the splash screen once and then becomes a noop
 * Splash screen fades so it is removed on animation end.
 */
var splashDomNode = document.querySelector('#splash');

function removeSplashScreen() {
  if (splashDomNode) {
    // keep a reference for the webkitAnimationEnd event handler
    // since splashDomNode gets nuked after this to make this function a noop
    var node = splashDomNode;
    node.classList.add('fade');
    node.addEventListener('webkitAnimationEnd', function() {
      node.remove();
    });
    splashDomNode = null;
  }
}

/*
 * Sets a message on the slash screen.
 * @param {string} message Text of message to sent
 * @param {boolean} isError Boolean indicating whether this is an error message
 */
function setSplashMessage(message, isError) {

  if (!splashDomNode) {
    return;
  }
  var messageNode = splashDomNode.querySelector('#splashMessage');
  var progressbar = splashDomNode.querySelector('#splashProgressbarWrapper');
  if (isError) {
    messageNode.classList.add('splashError');
    progressbar.classList.add('hidden');

  } else {
    messageNode.classList.remove('splashError');
    progressbar.classList.remove('hidden');
  }
  messageNode.textContent = message;
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package vg.civcraft.mc.civmenu;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;

/**
 *
 * @author Brian
 */
public class Utility {

    static Map<ItemStack, String> prettyNames = new HashMap<ItemStack, String>();

    public static void loadPrettyNames(File file) {
        prettyNames = new HashMap<ItemStack, String>();
        // Read Items
        try {
            BufferedReader CSVFile = new BufferedReader(new FileReader(file));
            String dataRow = CSVFile.readLine();
            while (dataRow != null) {
                String[] dataArray = dataRow.split(",");
                prettyNames.put(new ItemStack(Material.getMaterial(Integer.valueOf(dataArray[2]).intValue()), 1, Short.valueOf(dataArray[3])), dataArray[0]);
                dataRow = CSVFile.readLine();
            }
            CSVFile.close();
        } catch (IOException ex) {
            ex.printStackTrace();
            CivMenu.toConsole("Failed to load materials.csv");
        }
    }

    static String PrettyItem(ItemStack itemStack) {
        ItemStack key = itemStack.clone();
        key.setAmount(1);
        if (itemStack.hasItemMeta() && itemStack.getItemMeta().hasDisplayName()) {
            return itemStack.getAmount() + " " + itemStack.getItemMeta().getDisplayName();
        } else {
            if (prettyNames.containsKey(key)) {
                return itemStack.getAmount() + " " + prettyNames.get(key);
            } else {
                return itemStack.getAmount() + " " + itemStack.getType().name() + ":" + itemStack.getDurability();
            }
        }
    }

    /**
     * Convert a ItemSet to a pretty string
     *
     * If the item has a custom DisplayName it uses that, then if it has an
     * entry in the pretty name lookup table use that, otherwise use bukkit name
     *
     * @param itemStacks ItemStakcs to convert to string
     * @return Pretty String representing ItemStacks
     */
    static String PrettyItem(Set<ItemStack> itemStacks) {
        String output = "";
        for (ItemStack itemStack : itemStacks) {
            output += " "+PrettyItem(itemStack) + ",";
        }
        if (output.length() != 0) {
            output = output.substring(0, output.length() - 1);
        }
        return output;
    }

}


text:
<?php

return require __DIR__.'/se.php';