text:
package net.rdrei.android.wakimail.test;

import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.io.FileDescriptor;
import java.io.PrintWriter;

import net.rdrei.android.wakimail.ui.MailDetailFragment;

import org.junit.Test;
import org.junit.runner.RunWith;

import android.os.Bundle;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.support.v4.widget.SimpleCursorAdapter;

import com.google.inject.Inject;

@RunWith(InjectedTestRunner.class)
public class MailDetailFragmentTest {

	@Inject MailDetailFragment mFragment;

	private class LoaderManagerMock extends LoaderManager {

		@Override
		public void destroyLoader(int arg0) {
		}

		@Override
		public void dump(String arg0, FileDescriptor arg1, PrintWriter arg2,
				String[] arg3) {

		}

		@Override
		public <D> Loader<D> getLoader(int arg0) {
			return null;
		}

		@Override
		public <D> Loader<D> initLoader(int arg0, Bundle arg1,
				LoaderCallbacks<D> arg2) {
			return null;
		}

		@Override
		public <D> Loader<D> restartLoader(int arg0, Bundle arg1,
				LoaderCallbacks<D> arg2) {
			return null;
		}

	};

	@Test
	public void fragmentShouldLoad() {
		final MailDetailFragment fragment = spy(mFragment);
		when(fragment.getLoaderManager()).thenReturn(new LoaderManagerMock());

		fragment.onActivityCreated(null);

		verify(fragment).setListAdapter((SimpleCursorAdapter)anyObject());
	}

}


text:
@interface MainListViewController ()<UITableViewDelegate, UITableViewDataSource>

@property (nonatomic , strong) UITableView *tableview;

@property (nonatomic , strong) NSMutableArray *adapterArray;

@property (nonatomic , assign) BOOL tableViewShouldLoad;

@end

@implementation MainListViewController

- (void)setup {

    self.title = @"Live Animation";

    [super setup];

    [self loadDataSource];

    [self.tableview registerClass:[MainListCell class] forCellReuseIdentifier:NSStringFromClass([MainListCell class])];

    [self.contentView addSubview:self.tableview];

    [self insertDataToTableview];

    [self setNavRightItemWith:SKLocalizedString(@"change", @"切换语言")andImage:nil];

}

- (void)loadDataSource {

    NSArray * items = @[
                        [Item itemWithName:SKLocalizedString(@"fireworks Animation", nil) object:[[FireworksAnimationController alloc] init]],
                        [Item itemWithName:SKLocalizedString(@"thumb Animation", nil) object:[[ThumbsUpViewController alloc] init]],
                        [Item itemWithName:SKLocalizedString(@"car Animation", nil) object:[[FireworksAnimationController alloc] init]],
                        [Item itemWithName:SKLocalizedString(@"combo effect Animation", nil) object:[[FireworksAnimationController alloc] init]],
                        [Item itemWithName:SKLocalizedString(@"tableview scroll up Animation", nil) object:[[FireworksAnimationController alloc] init]],
                        [Item itemWithName:SKLocalizedString(@"barrage effect Animation", nil) object:[[FireworksAnimationController alloc] init]],
                        [Item itemWithName:SKLocalizedString(@"particle injection graphics Animation", nil) object:[[ParticleSprayController alloc] init]]
                        ];

    for (int i = 0; i < items.count; i ++) {
        [self.adapterArray addObject:[MainListCell cellAdapterWithData:items[i] cellHeight:0]];
    }
}

-(void)insertDataToTableview {

    NSMutableArray<NSIndexPath *> *indexPaths = [NSMutableArray array];
    for (int i = 0; i < self.adapterArray.count; i ++) {
        NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];
        [indexPaths addObject:indexPath];
    }

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        self.tableViewShouldLoad = YES;
        [self.tableview insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationAutomatic];
    });
}

- (void)rightItemClick:(id)sender {

    static NSInteger idex = 0;
    idex ++;
    if (idex == 3) {
        idex = 0;
    }

    kWeakObj(self)

    [kLanguageManager setLanguage:LanguageCodes[idex] completion:^(NSString *currentLanguage) {

        kStrongObj(self);

        [self.adapterArray removeAllObjects];

        [self loadDataSource];

        [self.tableview reloadData];

        [self setNavRightItemWith:SKLocalizedString(@"change", @"切换语言")andImage:nil];
    }];
}

#pragma mark - Lazy loading

- (NSMutableArray *)adapterArray {

    if (!_adapterArray) {
        _adapterArray = @[].mutableCopy;
    }
    return _adapterArray;
}

- (UITableView *)tableview {

    if (!_tableview) {
        _tableview = [[UITableView alloc] initWithFrame:self.contentView.bounds style:UITableViewStylePlain];
        _tableview.delegate = self;
        _tableview.dataSource = self;
        _tableview.rowHeight = 65.f;

        if (@available (iOS 11.0, *)) {
            _tableview.estimatedSectionHeaderHeight=0;
            _tableview.estimatedSectionFooterHeight=0;
            _tableview.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
        }
        _tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
    }
    return _tableview;
}

#pragma mark - UITableViewDataSource & UITableViewDelegate

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    return (UITableViewCell *)[tableView dequeueReusableCustomTableViewCellWithCellAdapter:self.adapterArray[indexPath.row] indexPath:indexPath controller:self];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return self.tableViewShouldLoad ? self.adapterArray.count : 0;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    [(CustomTableViewCell *)[tableView cellForRowAtIndexPath:indexPath] clickEvent];
}

-(UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleDefault;
}

@end

redpajama_set_name: RedPajamaGithub


text:
<?php declare(strict_types = 1);

namespace Dms\Web\Laravel\View;

use Dms\Core\Exception\InvalidArgumentException;

/**
 * The navigation element group.
 *
 * @author Elliot Levin <elliotlevin@hotmail.com>
 */
class NavigationElementGroup
{
    /**
     * @var string
     */
    protected $label;

    /**
     * @var string
     */
    protected $icon;

    /**
     * @var NavigationElement[]
     */
    protected $elements;

    /**
     * NavigationElementGroup constructor.
     *
     * @param string              $label
     * @param string              $icon
     * @param NavigationElement[] $elements
     */
    public function __construct(string $label, string $icon, array $elements)
    {
        InvalidArgumentException::verifyAllInstanceOf(__METHOD__, 'elements', $elements, NavigationElement::class);

        $this->label = $label;
        $this->icon  = $icon;

        $this->elements = $elements;
    }

    /**
     * @return string
     */
    public function getLabel() : string
    {
        return $this->label;
    }

    /**
     * @return string
     */
    public function getIcon() : string
    {
        return $this->icon;
    }

    /**
     * @return NavigationElement[]
     */
    public function getElements() : array
    {
        return $this->elements;
    }

    /**
     * @return string[]
     */
    public function getAllUrls() : array
    {
        $urls = [];

        foreach($this->elements as $element) {
            $urls[] = $element->getUrl();
        }

        return $urls;
    }

    /**
     * @param array $usersPermissionNames
     *
     * @return bool
     */
    public function shouldDisplay(array $usersPermissionNames) : bool
    {
        foreach ($this->elements as $element) {
            if (!$element->shouldDisplay($usersPermissionNames)) {
                return false;
            }
        }

        return true;
    }

    /**
     * @param NavigationElement[] $subNavigation
     *
     * @return NavigationElementGroup
     */
    public function withElements(array $subNavigation) : self
    {
        return new self($this->label, $this->icon, $subNavigation);
    }
}


text:
$nuspecFile = $args[0]

$nuspecXml = [xml](Get-Content $nuspecFile)
$nuspecXml.package.metadata.version = $env:APPVEYOR_BUILD_VERSION
$nuspecXml.Save($nuspecFile)

nuget pack $nuspecFile


text:
using namespace std;
//////////////////////////////////////////////////////////////////////////

class COperatePline
{
public:
	COperatePline(void);
	~COperatePline(void);

};


text:
/**
 *
 * @author Jonas Möller
 */
export interface ViewMetaData {
	selector: string,
	inputs: string[],
	outputs: string[],
	name: string
}


text:
package com.elterx.webapp.api;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyReader;
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;

import java.io.*;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;

@Provider
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class GsonProvider implements MessageBodyReader<Object>, MessageBodyWriter<Object> {

	private final String UTF8 = "UTF-8";

	private Gson gson;

	private Gson getGson() {
		if (null == gson) {
			final GsonBuilder gsonBuilder = new GsonBuilder()
			.setPrettyPrinting()
			.serializeNulls();
			gson = gsonBuilder.create();
		}

		return gson;
	}

	public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
		return true;
	}

	public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType,
			MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
					throws IOException, WebApplicationException {

		InputStreamReader streamReader = new InputStreamReader(entityStream, UTF8);

		try {
			Type jsonType;
			if (type.equals(genericType)) {
				jsonType = type;
			} else {
				jsonType = genericType;
			}

			return getGson().fromJson(streamReader, jsonType);
		} finally {
			streamReader.close();
		}
	}

	public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
		return true;
	}

	public long getSize(Object o, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
		return -1;
	}

	public void writeTo(Object o, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
			MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
					throws IOException, WebApplicationException {

		OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF8);

		try {
			Type jsonType;
			if (type.equals(genericType)) {
				jsonType = type;
			} else {
				jsonType = genericType;
			}

			getGson().toJson(o, jsonType, writer);
		} finally {
			writer.close();
		}
	}
}


text:
<?php
namespace App\Validation\Brokers;

use Illuminate\Validation\ValidationException;
use App\Models\Definitions\BaseDefinition as BaseDefinition;
use Illuminate\Validation\Validator as LaravelValidator;
use Illuminate\Support\Facades\Validator as ValidatorFacade;

abstract class DefinitionBroker {

	protected $definition;

	public function __construct(BaseDefinition $definition)
	{
		$this->definition = $definition;
	}

	/**
	 * Loads the rules from the field definitions, runs them through the Transformer.
	 *
	 * @return Array
	 */
	public function getRules()
	{
		$rules = [];

		// Load Rules here...

		return $this->transformRules($rules);
	}

	/**
	 * Transforms the validation syntax found in definitions, to the syntax
	 * used by Laravel.
	 *
	 * @param Array $rules
	 * @return Array
	 */
	protected function transformRules($rules)
	{
		$transformed = [];

		foreach($rules as $field => $ruleset)
		{
			foreach($ruleset as &$rule)
			{
				$rule = explode(':', $rule);

				switch($rule[0])
				{
					case 'required':
						$transformed[$field][] = 'present';
						$transformed[$field][] = 'required';
						break;

					case 'min_length':
						$transformed[$field][] = 'nullable';
						$transformed[$field][] = 'string';
						$transformed[$field][] = sprintf('min:%s', $rule[1]);
						break;

					case 'max_length':
						$transformed[$field][] = 'nullable';
						$transformed[$field][] = 'string';
						$transformed[$field][] = sprintf('max:%s', $rule[1]);
						break;

					case 'max_length_without_html':
						$transformed[$field][] = 'nullable';
						$transformed[$field][] = 'string';
						$transformed[$field][] = sprintf($rule[0] . ':%s', $rule[1]);
						break;

					case 'min_value':
						$transformed[$field][] = 'nullable';
						$transformed[$field][] = 'integer';
						$transformed[$field][] = sprintf('min:%s', $rule[1]);
						break;

					case 'max_value':
						$transformed[$field][] = 'nullable';
						$transformed[$field][] = 'integer';
						$transformed[$field][] = sprintf('max:%s', $rule[1]);
						break;

					case 'regex':
						$transformed[$field][] = sprintf('regex:/%s/', $rule[1]);
						break;

					case 'slug':
						$transformed[$field][] = 'nullable';
						$transformed[$field][] = sprintf('regex:/^[a-z0-9]+(?:-[a-z0-9]+)*$/');
						break;

					default:
						$transformed[$field][] = isset($rule[1]) ? sprintf('%s:%s', $rule[0], $rule[1]) : $rule[0];
						break;
				}
			}

			$transformed[$field] = array_unique($transformed[$field]);
		}

		return $transformed;
	}

	/**
	 * Returns a new Validator instance
	 *
	 * @param Array $data
	 * @param Array $messages
	 * @return \Illuminate\Validation\Validator
	 */
	public function getValidator(Array $data = [], Array $messages = [])
	{
		return ValidatorFacade::make($data, $this->getRules(), $messages);
	}

	/**
	 * Runs 'passes()' on the Validator instance.
	 *
	 * @return void
	 *
	 * @throws \Illuminate\Validation\ValidationException;
	 */
	public function validate()
	{
		$validator = $this->getValidator();

		if(!$validator->passes())
		{
			throw new ValidationException($validator);
		}
	}

}


text:
This page was generated with Wiki Builder. Do not change the format!

## Info
The definition for an "inventory flyout": a UI screen where we show you part of an otherwise hidden vendor inventory: like the Vault inventory buckets.

## Schema
* **Schema Type:** Definition
* **Type:** object

## Properties
Name | Type | Description
---- | ---- | -----------
lockedDescription | string | If the flyout is locked, this is the reason why.
displayProperties | [[DestinyDisplayPropertiesDefinition|Destiny-Definitions-Common-DestinyDisplayPropertiesDefinition]]:Definition | The title and other common properties of the flyout.
buckets | [[DestinyVendorInventoryFlyoutBucketDefinition|Destiny-Definitions-DestinyVendorInventoryFlyoutBucketDefinition]]:Definition[] | A list of inventory buckets and other metadata to show on the screen.
flyoutId | integer:uint32 | An identifier for the flyout, in case anything else needs to refer to them.
suppressNewness | boolean | If this is true, don't show any of the glistening "this is a new item" UI elements, like we show on the inventory items themselves in in-game UI.

## Example
```javascript
{
    // Type: string
    "lockedDescription": "",
    // Type: [[DestinyDisplayPropertiesDefinition|Destiny-Definitions-Common-DestinyDisplayPropertiesDefinition]]:Definition
    "displayProperties": {},
    // Type: [[DestinyVendorInventoryFlyoutBucketDefinition|Destiny-Definitions-DestinyVendorInventoryFlyoutBucketDefinition]]:Definition[]
    "buckets": [
       // Type: [[DestinyVendorInventoryFlyoutBucketDefinition|Destiny-Definitions-DestinyVendorInventoryFlyoutBucketDefinition]]:Definition
        {
            // Type: boolean
            "collapsible": false,
            // Type: [[Destiny.Definitions.DestinyInventoryBucketDefinition|Destiny-Definitions-DestinyInventoryBucketDefinition]]:integer:uint32
            "inventoryBucketHash": 0,
            // Type: [[DestinyItemSortType|Destiny-DestinyItemSortType]]:Enum
            "sortItemsBy": {}
        }
    ],
    // Type: integer:uint32
    "flyoutId": 0,
    // Type: boolean
    "suppressNewness": false
}

```

## References
1. https://bungie-net.github.io/multi/schema_Destiny-Definitions-DestinyVendorInventoryFlyoutDefinition.html#schema_Destiny-Definitions-DestinyVendorInventoryFlyoutDefinition


text:
/*global describe, beforeEach, it*/
'use strict';

var path    = require('path');
var helpers = require('yeoman-generator').test;

describe('basic generator', function () {
    beforeEach(function (done) {
        helpers.testDirectory(path.join(__dirname, 'temp'), function (err) {
            if (err) {
                return done(err);
            }

            this.app = helpers.createGenerator('basic:app', [
                '../../app'
            ]);
            done();
        }.bind(this));
    });

    it('creates expected files', function (done) {
        var expected = [
            // add files you expect to exist here.
            '.jshintrc',
            '.editorconfig',
            'LICENSE',
            'package.json',
            'README.md',
            '.gitignore',
            'Gruntfile.js',
            'test/index.html',
            'test/test.js'
        ];

        helpers.mockPrompt(this.app, {
            'someOption': true
        });
        this.app.options['skip-install'] = true;
        this.app.run({}, function () {
            helpers.assertFiles(expected);
            done();
        });
    });
});


text:
<?php

namespace Sustain\UserBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class SustainUserBundle extends Bundle
{
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">

  <kbase name="drl_kiesample" packages="drl_kiesample">
    <ksession name="ksession1" type="stateless"/>
    <ksession name="ksession2"/>
    <ksession name="statelessWithGroupedListeners" type="stateless"/>
  </kbase>

  <kbase name="drl_kiesample2" packages="drl_kiesample2">
    <ksession name="ksession3" type="stateless"/>
    <ksession name="loggerSession" type="stateless"/>
    <ksession name="statefulSession" type="stateful"/>
  </kbase>

  <kbase name="drl_persistence" packages="drl_persistence">
    <ksession name="jpaSingleSessionCommandService2"/>
  </kbase>

  <kbase name="drl_persistence_rb" packages="drl_persistence_rb">
    <ksession name="jpaSingleSessionCommandServiceRollback"/>
  </kbase>

  <kbase name="drl_timer_flow" packages="drl_timer_flow">
    <ksession name="jpaSSCS"/>
  </kbase>

</kmodule>


text:
package com.baidubce.services.tsdb.model;

import com.baidubce.auth.BceCredentials;
import com.baidubce.model.AbstractBceRequest;

import java.util.List;
import java.util.Map;

/**
 * Represent the request for exporting datapoints.
 */
public class ExportDatapointsRequest extends AbstractBceRequest {

    private String databaseId;

    private String bosUrl;

    private String format;

    private List<String> metrics;

    private Map<String, List<TaskTagFilter>> tags;

    private Long start;

    private Long end;

    private boolean singleFile;

    public String getDatabaseId() {
        return databaseId;
    }

    public void setDatabaseId(String databaseId) {
        this.databaseId = databaseId;
    }

    public String getBosUrl() {
        return bosUrl;
    }

    public void setBosUrl(String bosUrl) {
        this.bosUrl = bosUrl;
    }

    public String getFormat() {
        return format;
    }

    public void setFormat(String format) {
        this.format = format;
    }

    public List<String> getMetrics() {
        return metrics;
    }

    public void setMetrics(List<String> metrics) {
        this.metrics = metrics;
    }

    public Map<String, List<TaskTagFilter>> getTags() {
        return tags;
    }

    public void setTags(Map<String, List<TaskTagFilter>> tags) {
        this.tags = tags;
    }

    public Long getStart() {
        return start;
    }

    public void setStart(Long start) {
        this.start = start;
    }

    public Long getEnd() {
        return end;
    }

    public void setEnd(Long end) {
        this.end = end;
    }

    public boolean isSingleFile() {
        return singleFile;
    }

    public void setSingleFile(boolean singleFile) {
        this.singleFile = singleFile;
    }

    @Override
    public ExportDatapointsRequest withRequestCredentials(BceCredentials credentials) {
        this.setRequestCredentials(credentials);
        return this;
    }
}


text:
"""
Render documents as plaintext.
Very scruffy and not very powerful.
Should probably be modified to generate markdown syntax.
"""
from __future__ import absolute_import

from pyth import document
from pyth.format import PythWriter

from six import StringIO

class PlaintextWriter(PythWriter):

    @classmethod
    def write(klass, document, target=None, encoding="utf-8", newline="\n"):
        if target is None:
            target = StringIO()

        writer = PlaintextWriter(document, target, encoding, newline)
        return writer.go()

    def __init__(self, doc, target, encoding, newline):
        self.document = doc
        self.target = target
        self.encoding = encoding
        self.newline = newline
        self.indent = -1
        self.paragraphDispatch = {
            document.List: self.list,
            document.Paragraph: self.paragraph
        }

    def go(self):
        np = len(self.document.content)
        for (i, paragraph) in enumerate(self.document.content):
            handler = self.paragraphDispatch[paragraph.__class__]
            handler(paragraph)
            if i < np - 1:
                self.target.write(self.newline)

        self.target.truncate()

        self.target.seek(0)
        return self.target

    def paragraph(self, paragraph, prefix=""):
        content = []
        for text in paragraph.content:
            content.append("".join(text.content))
        content = "".join(content)

        for line in content.splitlines():
            self.target.write("  " * self.indent)
            self.target.write(prefix)
            self.target.write(line)
            self.target.write(self.newline)
            if prefix: prefix = "  "

    def list(self, list, prefix=None):
        self.indent += 1
        for (i, entry) in enumerate(list.content):
            for (j, paragraph) in enumerate(entry.content):
                prefix = "* " if j == 0 else "  "
                handler = self.paragraphDispatch[paragraph.__class__]
                handler(paragraph, prefix)
        self.indent -= 1


text:
using System;
using System.Collections;
using System.Runtime.Serialization;
using Solenoid.Expressions.Support.TypeResolution;

namespace Solenoid.Expressions
{
	/// <summary>
	///     Represents parsed method node in the navigation expression.
	/// </summary>
	/// <author>Aleksandar Seovic</author>
	[Serializable]
	public class ArrayConstructorNode : NodeWithArguments
	{
		private Type _arrayType;

		/// <summary>
		///     Create a new instance
		/// </summary>
		public ArrayConstructorNode()
		{
		}

		/// <summary>
		///     Create a new instance from SerializationInfo
		/// </summary>
		protected ArrayConstructorNode(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		/// <summary>
		///     Creates new instance of the type defined by this node.
		/// </summary>
		/// <param name="context">Context to evaluate expressions against.</param>
		/// <param name="evalContext">Current expression evaluation context.</param>
		/// <returns>Node's value.</returns>
		protected override object Get(object context, EvaluationContext evalContext)
		{
			if (_arrayType == null)
			{
				lock (this)
				{
					if (_arrayType == null)
					{
						_arrayType = TypeResolutionUtils.ResolveType(getText());
					}
				}
			}

			var rankRoot = getFirstChild();
			var dimensions = rankRoot.getNumberOfChildren();
			var ranks = new int[dimensions];
			if (dimensions > 0)
			{
				var i = 0;
				var rankNode = rankRoot.getFirstChild();
				while (rankNode != null)
				{
					ranks[i++] = (int) GetValue((BaseNode) rankNode, context, evalContext);
					rankNode = rankNode.getNextSibling();
				}
				return Array.CreateInstance(_arrayType, ranks);
			}
			var valuesRoot = getFirstChild().getNextSibling();
			if (valuesRoot != null)
			{
				var values = (ArrayList) GetValue(((BaseNode) valuesRoot), context, evalContext);
				return values.ToArray(_arrayType);
			}

			throw new ArgumentException("You have to specify either rank or initializer for an array.");
		}
	}
}


text:
namespace Nop.Plugin.Api
{
    using IdentityServer4.EntityFramework.DbContexts;
    using Microsoft.EntityFrameworkCore.Infrastructure;
    using Microsoft.EntityFrameworkCore.Migrations;
    using Nop.Core;
    using Nop.Core.Infrastructure;
    using Nop.Plugin.Api.Data;
    using Nop.Plugin.Api.Domain;
    using Nop.Plugin.Api.Helpers;
    using Nop.Services.Configuration;
    using Nop.Services.Localization;
    using Nop.Services.Plugins;
    using Nop.Web.Framework.Menu;

    public class ApiPlugin : BasePlugin, IAdminMenuPlugin
    {
        //private readonly IWebConfigMangerHelper _webConfigMangerHelper;
        private readonly ApiObjectContext _objectContext;
        private readonly ISettingService _settingService;
        private readonly IWorkContext _workContext;
        private readonly IWebHelper _webHelper;
        private readonly ILocalizationService _localizationService;

        public ApiPlugin(ApiObjectContext objectContext,/*IWebConfigMangerHelper webConfigMangerHelper,*/ ISettingService settingService, IWorkContext workContext,
            ILocalizationService localizationService, IWebHelper webHelper
/*, IConfiguration configuration*/)
        {
            _objectContext = objectContext;
            //_webConfigMangerHelper = webConfigMangerHelper;
            _settingService = settingService;
            _workContext = workContext;
            _localizationService = localizationService;
            _webHelper = webHelper;
            //_configuration = configuration;
        }

        //private readonly IConfiguration _configuration;

        public override void Install()
        {
            var configManagerHelper = new NopConfigManagerHelper();

            // some of third party libaries that we use for WebHooks and Swagger use older versions
            // of certain assemblies so we need to redirect them to the those that nopCommerce uses
            // TODO: Upgrade 4.1. check this!
            //configManagerHelper.AddBindingRedirects();

            // required by the WebHooks support
            // TODO: Upgrade 4.1. check this!
            //configManagerHelper.AddConnectionString();

            _objectContext.Install();

            //locales
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api", "Api plugin");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Menu.ManageClients", "Manage Api Clients");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Configure", "Configure Web Api");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.GeneralSettings", "General Settings");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.EnableApi", "Enable Api");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.EnableApi.Hint", "By checking this settings you can Enable/Disable the Web Api");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.AllowRequestsFromSwagger", "Allow Requests From Swagger");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.AllowRequestsFromSwagger.Hint", "Swagger is the documentation generation tool used for the API (/Swagger). It has a client that enables it to make GET requests to the API endpoints. By enabling this option you will allow all requests from the swagger client. Do Not Enable on live site, it is only for demo sites or local testing!!!");

            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Menu.Title","API");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Menu.Settings.Title","Settings");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Menu.Clients.Title", "Clients");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Menu.Docs.Title", "Docs");

            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Page.Settings.Title", "Api Settings");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Page.Clients.Title", "Api Clients");

            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Page.Clients.Create.Title", "Add a new Api client");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Page.Clients.Edit.Title", "Edit Api client");

            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Client.Name", "Name");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Client.Name.Hint", "Name Hint");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Client.ClientId", "Client Id");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Client.ClientId.Hint", "The id of the client");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Client.ClientSecret", "Client Secret");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Client.ClientSecret.Hint", "The client secret is used during the authentication for obtaining the Access Token");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Client.CallbackUrl", "Callback Url");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Client.CallbackUrl.Hint", "The url where the Authorization code will be send");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Client.IsActive", "Is Active");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Client.IsActive.Hint", "You can use it to enable/disable the access to your store for the client");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Client.AddNew", "Add New Client");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Client.Edit", "Edit");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Client.Created", "Created");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Client.Deleted", "Deleted");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Entities.Client.FieldValidationMessages.Name", "Name is required");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Entities.Client.FieldValidationMessages.ClientId", "Client Id is required");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Entities.Client.FieldValidationMessages.ClientSecret", "Client Secret is required");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Entities.Client.FieldValidationMessages.CallbackUrl", "Callback Url is required");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Settings.GeneralSettingsTitle", "General Settings");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Edit", "Edit");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.Client.BackToList", "Back To List");

            _localizationService.AddOrUpdatePluginLocaleResource("Api.Categories.Fields.Id.Invalid", "Id is invalid");
            _localizationService.AddOrUpdatePluginLocaleResource("Api.InvalidPropertyType", "Invalid Property Type");
            _localizationService.AddOrUpdatePluginLocaleResource("Api.InvalidType", "Invalid {0} type");
            _localizationService.AddOrUpdatePluginLocaleResource("Api.InvalidRequest", "Invalid request");
            _localizationService.AddOrUpdatePluginLocaleResource("Api.InvalidRootProperty", "Invalid root property");
            _localizationService.AddOrUpdatePluginLocaleResource("Api.NoJsonProvided", "No Json provided");
            _localizationService.AddOrUpdatePluginLocaleResource("Api.InvalidJsonFormat", "Json format is invalid");
            _localizationService.AddOrUpdatePluginLocaleResource("Api.Category.InvalidImageAttachmentFormat", "Invalid image attachment base64 format");
            _localizationService.AddOrUpdatePluginLocaleResource("Api.Category.InvalidImageSrc", "Invalid image source");
            _localizationService.AddOrUpdatePluginLocaleResource("Api.Category.InvalidImageSrcType", "You have provided an invalid image source/attachment ");

            _localizationService.AddOrUpdatePluginLocaleResource("Api.WebHooks.CouldNotRegisterWebhook", "Could not register WebHook due to error: {0}");
            _localizationService.AddOrUpdatePluginLocaleResource("Api.WebHooks.CouldNotRegisterDuplicateWebhook", "Could not register WebHook because a webhook with the same URI and Filters is already registered.");
            _localizationService.AddOrUpdatePluginLocaleResource("Api.WebHooks.CouldNotUpdateWebhook", "Could not update WebHook due to error: {0}");
            _localizationService.AddOrUpdatePluginLocaleResource("Api.WebHooks.CouldNotDeleteWebhook", "Could not delete WebHook due to error: {0}");
            _localizationService.AddOrUpdatePluginLocaleResource("Api.WebHooks.CouldNotDeleteWebhooks", "Could not delete WebHooks due to error: {0}");
            _localizationService.AddOrUpdatePluginLocaleResource("Api.WebHooks.InvalidFilters", "The following filters are not valid: '{0}'. A list of valid filters can be obtained from the path '{1}'.");

            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.EnableLogging", "Enable Logging");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Api.Admin.EnableLogging.Hint", "By enable logging you will see webhook messages in the Log. These messages are needed ONLY for diagnostic purposes. NOTE: A restart is required when changing this setting in order to take effect");

            ApiSettings settings = new ApiSettings
            {
                EnableApi = true,
                AllowRequestsFromSwagger = false
            };

            _settingService.SaveSetting(settings);

            base.Install();

            // Changes to Web.Config trigger application restart.
            // This doesn't appear to affect the Install function, but just to be safe we will made web.config changes after the plugin was installed.
            //_webConfigMangerHelper.AddConfiguration();
        }

        public override void Uninstall()
        {
            _objectContext.Uninstall();

            var persistedGrantMigrator = EngineContext.Current.Resolve<PersistedGrantDbContext>().GetService<IMigrator>();
            persistedGrantMigrator.Migrate("0");

            var configurationMigrator = EngineContext.Current.Resolve<ConfigurationDbContext>().GetService<IMigrator>();
            configurationMigrator.Migrate("0");

            // TODO: Delete all resources
            //locales
            _localizationService.DeletePluginLocaleResource("Plugins.Api");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Menu.ManageClients");

            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Menu.Title");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Menu.Settings.Title");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Menu.Clients.Title");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Menu.Docs.Title");

            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Configure");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.GeneralSettings");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.EnableApi");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.EnableApi.Hint");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.AllowRequestsFromSwagger");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.AllowRequestsFromSwagger.Hint");

            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Client.Name");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Client.ClientId");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Client.ClientSecret");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Client.CallbackUrl");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Client.IsActive");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Client.AddNew");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Client.Edit");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Client.Created");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Client.Deleted");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Entities.Client.FieldValidationMessages.Name");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Entities.Client.FieldValidationMessages.ClientId");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Entities.Client.FieldValidationMessages.ClientSecret");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Entities.Client.FieldValidationMessages.CallbackUrl");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Settings.GeneralSettingsTitle");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Edit");
            _localizationService.DeletePluginLocaleResource("Plugins.Api.Admin.Client.BackToList");

            _localizationService.DeletePluginLocaleResource("Api.WebHooks.CouldNotRegisterWebhook");
            _localizationService.DeletePluginLocaleResource("Api.WebHooks.CouldNotRegisterDuplicateWebhook");
            _localizationService.DeletePluginLocaleResource("Api.WebHooks.CouldNotUpdateWebhook");
            _localizationService.DeletePluginLocaleResource("Api.WebHooks.CouldNotDeleteWebhook");
            _localizationService.DeletePluginLocaleResource("Api.WebHooks.CouldNotDeleteWebhooks");
            _localizationService.DeletePluginLocaleResource("Api.WebHooks.InvalidFilters");

            base.Uninstall();

            // Changes to Web.Config trigger application restart.
            // This doesn't appear to affect the uninstall function, but just to be safe we will made web.config changes after the plugin was uninstalled.
            //_webConfigMangerHelper.RemoveConfiguration();
        }

        public void ManageSiteMap(SiteMapNode rootNode)
        {
            string pluginMenuName = _localizationService.GetResource("Plugins.Api.Admin.Menu.Title",languageId: _workContext.WorkingLanguage.Id, defaultValue: "API");

            string settingsMenuName = _localizationService.GetResource("Plugins.Api.Admin.Menu.Settings.Title", languageId: _workContext.WorkingLanguage.Id, defaultValue: "API");

            string manageClientsMenuName = _localizationService.GetResource("Plugins.Api.Admin.Menu.Clients.Title", languageId: _workContext.WorkingLanguage.Id, defaultValue: "API");

            const string adminUrlPart = "Admin/";

            var pluginMainMenu = new SiteMapNode
            {
                Title = pluginMenuName,
                Visible = true,
                SystemName = "Api-Main-Menu",
                IconClass = "fa-genderless"
            };

            pluginMainMenu.ChildNodes.Add(new SiteMapNode
            {
                Title = settingsMenuName,
                Url = _webHelper.GetStoreLocation() + adminUrlPart + "ApiAdmin/Settings",
                Visible = true,
                SystemName = "Api-Settings-Menu",
                IconClass = "fa-genderless"
            });

            pluginMainMenu.ChildNodes.Add(new SiteMapNode
            {
                Title = manageClientsMenuName,
                Url = _webHelper.GetStoreLocation() + adminUrlPart + "ManageClientsAdmin/List",
                Visible = true,
                SystemName = "Api-Clients-Menu",
                IconClass = "fa-genderless"
            });

            string pluginDocumentationUrl = "https://github.com/SevenSpikes/api-plugin-for-nopcommerce";

            pluginMainMenu.ChildNodes.Add(new SiteMapNode
                {
                    Title = _localizationService.GetResource("Plugins.Api.Admin.Menu.Docs.Title"),
                    Url = pluginDocumentationUrl,
                    Visible = true,
                    SystemName = "Api-Docs-Menu",
                    IconClass = "fa-genderless"
                });//TODO: target="_blank"

            rootNode.ChildNodes.Add(pluginMainMenu);
        }
    }
}


text:
SamPy.bolshoi.plotstellarmf.main
================================

.. currentmodule:: SamPy.bolshoi.plotstellarmf

.. autofunction:: main


text:
import FauxtonAPI from '../../core/api';
import React from 'react';
import Helpers from '../../helpers';
import Components from '../components/react-components';
import NewReplication from './components/newreplication';
import Activity from './components/activity';
import {checkReplicationDocID} from './api';
import {OnePane, OnePaneHeader, OnePaneContent} from '../components/layouts';
import {TabElementWrapper, TabElement} from '../components/components/tabelement';
import ReplicateActivity from './components/replicate-activity';

const {LoadLines, Polling, RefreshBtn} = Components;

export default class ReplicationController extends React.Component {

  loadReplicationInfo (props, oldProps) {
    this.props.initReplicator(props.routeLocalSource, props.localSource);
    this.getAllActivity();
    this.loadReplicationStateFrom(props, oldProps);
  }

  loadReplicationStateFrom (props, oldProps) {
    if (props.replicationId && props.replicationId !== oldProps.replicationId) {
      this.props.clearReplicationForm();
      this.props.getReplicationStateFrom(props.replicationId);
    }
  }

  getAllActivity () {
    this.props.getReplicationActivity();
    this.props.getReplicateActivity();
  }

  componentDidMount () {
    this.props.checkForNewApi();
    this.props.getDatabasesList();
    this.loadReplicationInfo(this.props, {});
  }

  UNSAFE_componentWillReceiveProps (nextProps) {
    this.loadReplicationStateFrom(nextProps, this.props);
    if (this.props.tabSection !== 'new replication' && nextProps.tabSection === 'new replication') {
      this.props.clearReplicationForm();
    }
  }

  componentWillUnmount () {
    this.props.clearReplicationForm();
  }

  showSection () {
    const {
      replicationSource, replicationTarget, replicationType, replicationDocName,
      databases, localSource, remoteSource, remoteTarget,
      localTarget, statusDocs, statusFilter, loading, allDocsSelected,
      someDocsSelected, showConflictModal, localSourceKnown, localTargetKnown, updateFormField,
      authenticated, activityLoading, submittedNoChange, activitySort, tabSection,
      replicateInfo, replicateLoading, replicateFilter, allReplicateSelected, someReplicateSelected,
      hideConflictModal, isConflictModalVisible, filterDocs,
      filterReplicate, replicate, clearReplicationForm, selectAllDocs, changeActivitySort, selectDoc,
      deleteDocs, deleteReplicates, selectAllReplicates, selectReplicate,
      sourceAuthType, sourceAuth, targetAuthType, targetAuth
    } = this.props;

    if (tabSection === 'new replication') {
      if (loading) {
        return <LoadLines/>;
      }

      return <NewReplication
        docs={statusDocs}
        localTargetKnown={localTargetKnown}
        localSourceKnown={localSourceKnown}
        clearReplicationForm={clearReplicationForm}
        replicate={replicate}
        replicationSource={replicationSource}
        replicationTarget={replicationTarget}
        replicationType={replicationType}
        replicationDocName={replicationDocName}
        databases={databases}
        localSource={localSource}
        remoteSource={remoteSource}
        remoteTarget={remoteTarget}
        localTarget={localTarget}
        sourceAuthType={sourceAuthType}
        sourceAuth={sourceAuth}
        targetAuthType={targetAuthType}
        targetAuth={targetAuth}
        updateFormField={updateFormField}
        conflictModalVisible={isConflictModalVisible}
        hideConflictModal={hideConflictModal}
        showConflictModal={showConflictModal}
        checkReplicationDocID={checkReplicationDocID}
        authenticated={authenticated}
        submittedNoChange={submittedNoChange}
      />;
    }

    if (tabSection === '_replicate') {
      if (replicateLoading) {
        return <LoadLines />;
      }

      return <ReplicateActivity
        docs={replicateInfo}
        filter={replicateFilter}
        onFilterChange={filterReplicate}
        selectDoc={selectReplicate}
        selectAllDocs={selectAllReplicates}
        allDocsSelected={allReplicateSelected}
        someDocsSelected={someReplicateSelected}
        activitySort={activitySort}
        changeActivitySort={changeActivitySort}
        deleteDocs={deleteReplicates}
      />;
    }

    if (activityLoading) {
      return <LoadLines/>;
    }

    return <Activity
      docs={statusDocs}
      filter={statusFilter}
      onFilterChange={filterDocs}
      selectAllDocs={selectAllDocs}
      selectDoc={selectDoc}
      allDocsSelected={allDocsSelected}
      someDocsSelected={someDocsSelected}
      deleteDocs={deleteDocs}
      activitySort={activitySort}
      changeActivitySort={changeActivitySort}
    />;
  }

  getHeaderComponents () {
    if (this.props.tabSection === 'new replication') {
      return null;
    }
    let rightHeaderclass = "right-header-flex";
    if (Helpers.isIE1X()) {
      rightHeaderclass += " " + rightHeaderclass + "--ie1X";
    }

    return (

        <Polling
          min={60}
          max={600}
          startValue={300}
          stepSize={60}
          onPoll={this.getAllActivity.bind(this)}
        />
        <RefreshBtn
          refresh={this.getAllActivity.bind(this)}
        />

    );
  }

  getTabElements () {
    const {tabSection} = this.props;
    const elements = [
      <TabElement
        key={1}
        selected={tabSection === 'activity'}
        text={"Replicator DB Activity"}
        onChange={this.onTabChange.bind(this, 'activity', '#/replication')}
      />
    ];

    if (this.props.supportNewApi) {
      elements.push(
        <TabElement
          key={2}
          selected={tabSection === '_replicate'}
          text={"_replicate Activity"}
          onChange={this.onTabChange.bind(this, '_replicate', '#/replication/_replicate')}
        />
      );
    }

    return elements;
  }

  onTabChange (section, url) {
    // this.props.changeTabSection(section, url);
    FauxtonAPI.navigate(url);
  }

  getCrumbs () {
    if (this.props.tabSection === 'new replication') {
      return [{'name': 'Job Configuration'}];
    }
    return [{'name': 'Replication'}];
  }

  getTabs () {
    if (this.props.tabSection === 'new replication') {
      return null;
    }

    return (
      <TabElementWrapper>
        {this.getTabElements()}
      </TabElementWrapper>
    );
  }

  render () {
    const { checkingAPI } = this.props;

    if (checkingAPI) {
      return <LoadLines />;
    }

    return (
      <OnePane>
        <OnePaneHeader crumbs={this.getCrumbs()}>
          {this.getHeaderComponents()}
        </OnePaneHeader>
        <OnePaneContent>

            {this.getTabs()}

              {this.showSection()}

        </OnePaneContent>
      </OnePane>
    );
  }
}


text:
/* Description
 *     Demonstrate NDKCamera's PREVIEW mode -- hooks camera directly into
 *     display.
 *     Control:
 *         Double-Tap on Android device's screen to toggle start/stop preview
 *     Tested:
 *         Google Pixel and Nexus 6 phones
 */
#include <jni.h>
#include <cstring>
#include <utils/native_debug.h>
#include "camera_manager.h"
#include "camera_engine.h"

/**
 * Application object:
 *   the top level camera application object, maintained by native code only
 */
CameraAppEngine *pEngineObj = nullptr;

/**
 * createCamera() Create application instance and NDK camera object
 * @param  width is the texture view window width
 * @param  height is the texture view window height
 * In this sample, it takes the simplest approach in that:
 * the android system display size is used to view full screen
 * preview camera images. Onboard Camera most likely to
 * support the onboard panel size on that device. Camera is most likely
 * to be oriented as landscape mode, the input width/height is in
 * landscape mode. TextureView on Java side handles rotation for
 * portrait mode.
 * @return application object instance ( not used in this sample )
 */
extern "C" JNIEXPORT jlong JNICALL
Java_com_sample_textureview_ViewActivity_createCamera(JNIEnv *env,
                                                      jobject instance,
                                                      jint width, jint height) {
  pEngineObj = new CameraAppEngine(env, instance, width, height);
  return reinterpret_cast<jlong>(pEngineObj);
}

/**
 * deleteCamera():
 *   releases native application object, which
 *   triggers native camera object be released
 */
extern "C" JNIEXPORT void JNICALL
Java_com_sample_textureview_ViewActivity_deleteCamera(JNIEnv *env,
                                                      jobject instance,
                                                      jlong ndkCameraObj) {
  if (!pEngineObj || !ndkCameraObj) {
    return;
  }
  CameraAppEngine *pApp = reinterpret_cast<CameraAppEngine *>(ndkCameraObj);
  ASSERT(pApp == pEngineObj, "NdkCamera Obj mismatch");

  delete pApp;

  // also reset the private global object
  pEngineObj = nullptr;
}

/**
 * getCameraCompatibleSize()
 * @returns minimium camera preview window size for the given
 * requested camera size in CreateCamera() function, with the same
 * ascpect ratio. essentially,
 *   1) Display device size decides NDKCamera object preview size
 *   2) Chosen NDKCamera preview size passed to TextView to
 *      reset textureView size
 *   3) textureView size is stretched when previewing image
 *      on display device
 */
extern "C" JNIEXPORT jobject JNICALL
Java_com_sample_textureview_ViewActivity_getMinimumCompatiblePreviewSize(
    JNIEnv *env, jobject instance, jlong ndkCameraObj) {
  if (!ndkCameraObj) {
    return nullptr;
  }
  CameraAppEngine *pApp = reinterpret_cast<CameraAppEngine *>(ndkCameraObj);
  jclass cls = env->FindClass("android/util/Size");
  jobject previewSize =
      env->NewObject(cls, env->GetMethodID(cls, "<init>", "(II)V"),
                     pApp->GetCompatibleCameraRes().width,
                     pApp->GetCompatibleCameraRes().height);
  return previewSize;
}

/**
 * getCameraSensorOrientation()
 * @ return camera sensor orientation angle relative to Android device's
 * display orientation. This sample only deal to back facing camera.
 */
extern "C" JNIEXPORT jint JNICALL
Java_com_sample_textureview_ViewActivity_getCameraSensorOrientation(
    JNIEnv *env, jobject instance, jlong ndkCameraObj) {
  ASSERT(ndkCameraObj, "NativeObject should not be null Pointer");
  CameraAppEngine *pApp = reinterpret_cast<CameraAppEngine *>(ndkCameraObj);
  return pApp->GetCameraSensorOrientation(ACAMERA_LENS_FACING_BACK);
}

/**
 * OnPreviewSurfaceCreated()
 *   Notification to native camera that java TextureView is ready
 *   to preview video. Simply create cameraSession and
 *   start camera preview
 */
extern "C" JNIEXPORT void JNICALL
Java_com_sample_textureview_ViewActivity_onPreviewSurfaceCreated(
    JNIEnv *env, jobject instance, jlong ndkCameraObj, jobject surface) {
  ASSERT(ndkCameraObj && (jlong)pEngineObj == ndkCameraObj,
         "NativeObject should not be null Pointer");
  CameraAppEngine *pApp = reinterpret_cast<CameraAppEngine *>(ndkCameraObj);
  pApp->CreateCameraSession(surface);
  pApp->StartPreview(true);
}

/**
 * OnPreviewSurfaceDestroyed()
 *   Notification to native camera that java TextureView is destroyed
 *   Native camera would:
 *      * stop preview
 */
extern "C" JNIEXPORT void JNICALL
Java_com_sample_textureview_ViewActivity_onPreviewSurfaceDestroyed(
    JNIEnv *env, jobject instance, jlong ndkCameraObj, jobject surface) {
  CameraAppEngine *pApp = reinterpret_cast<CameraAppEngine *>(ndkCameraObj);
  ASSERT(ndkCameraObj && pEngineObj == pApp,
         "NativeObject should not be null Pointer");
  jclass cls = env->FindClass("android/view/Surface");
  jmethodID toString =
      env->GetMethodID(cls, "toString", "()Ljava/lang/String;");

  jstring destroyObjStr =
      reinterpret_cast<jstring>(env->CallObjectMethod(surface, toString));
  const char *destroyObjName = env->GetStringUTFChars(destroyObjStr, nullptr);

  jstring appObjStr = reinterpret_cast<jstring>(
      env->CallObjectMethod(pApp->GetSurfaceObject(), toString));
  const char *appObjName = env->GetStringUTFChars(appObjStr, nullptr);

  ASSERT(!strcmp(destroyObjName, appObjName), "object Name MisMatch");

  env->ReleaseStringUTFChars(destroyObjStr, destroyObjName);
  env->ReleaseStringUTFChars(appObjStr, appObjName);

  pApp->StartPreview(false);
}


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

class Stylist extends CI_Controller
{

    protected $message;
    protected $table;
    protected $image_up_path;
    protected $image_thumb_up_path;
    protected $cv_up_path;
    protected $user_images_table;

    function __construct()
    {
        parent::__construct();
        $languages = get_all_languages();
        $this->lang->load('auto', $languages[$this->uri->segment(1)]);
        $this->message = array();

        $this->table = TBL_STYLIST;
        $this->image_up_path = STYLIST_IMAGE_UP_PATH;
        $this->image_thumb_up_path = STYLIST_THUMB_UP_PATH;
        $this->user_images_table = TBL_STYLIST_IMAGES;
        $this->cv_up_path = STYLIST_CV_UP_PATH;

        $this->load->model('model_languages','modelLangAlias');
        $this->load->model('model_stylist', 'modelNameAlias');

    }

    public function signup()
    {
        $postdata = file_get_contents("php://input");
        $request = json_decode($postdata);

        $error = FALSE;

        @$name = $request->name;
        @$email = $request->email;
        @$phone = $request->phone;
        @$city = $request->city;
        @$country = $request->country;
        @$description = $request->description;

        @$language = $request->language;

        @$model_region = $request->model_region;
        @$model_age = $request->model_age;
        @$model_info = $request->model_info;
        @$model_gender = $request->model_gender;
        @$model_marrital_status = $request->model_marrital_status;
        @$model_exp = $request->model_exp;

        $code = $this->modelNameAlias->genUniqCode();
        $orderby = $this->modelNameAlias->lastOrderID();
        $orderby = ($orderby->orderby != NULL) ? ++$orderby->orderby : 1;

        //Username checking
        if($this->isAlreadyRegistered(@$email))
        {
            $error = TRUE;
            $data = array(
                'error' => TRUE,
                'message' => 'Email already taken'
            );
        }

        if(!$error)
        {

            $save = array(
               $this->table.'.orderby' => $orderby,
               $this->table.'.code' => $code,
               $this->table.'.name' => @$name,
               $this->table.'.contact_no' => @$phone,
               $this->table.'.email' => @$email,
               $this->table.'.description' => @$description,
               $this->table.'.city' => @$city,
               $this->table.'.country' => @$country,
               $this->table.'.model_region' => @$model_region,
               $this->table.'.model_gender' => @$model_gender,
               $this->table.'.model_info' => @$model_info,
               $this->table.'.model_exp' => @$model_exp,
               $this->table.'.model_marrital_status' => @$model_marrital_status,
               $this->table.'.model_age' => @$model_age,
               $this->table.'.is_active' => 'N',
               $this->table.'.added_date' => date('Y-m-d h:i:s A')
            );

            $id = $this->modelNameAlias->insertRecord($save);

            $this->modelNameAlias->removeLangByModel($id);
            //Insert the languages spoken by the model
            for($i=0; $i<count(@$language);$i++)
            {
                $this->modelNameAlias->setLanguage($id, @$language[$i]);
            }

            if($id)
            {
                  //Send an invitation email to registered user
                  $this->load->library('email');
                  $this->config->load('email', true);
                  $this->email->from(INFO_EMAIL, SITE_NAME);
                  $this->email->to(@$email);
                  $this->email->subject('Welcome to Avenir Events.com. Thanks for registering with us!');

                  $full_name = @$name;
                  $email = @$email;
                  $phone = @$phone;
                  $type = 'Stylist';

                  $notify = array(
                      'full_name' => $full_name,
                      'email' => $email
                  );

                  include_once(MISC_PATH . "/emails.php");
                  $message = $registration_email;

                  //Send email
                  $this->email->message($message);
                  $this->email->send();

                  //Send email to Administrator
                  $this->email->from($email, $full_name);
                  $this->email->to(INFO_EMAIL);
                  $this->email->subject( $type . ' : Someone registered with avenir events');

                  $notify_message = $notify_admin;

                  //Send email
                  $this->email->message($notify_message);
                  $this->email->send();
                  //EOF Administrator notification sending

                $data = array(
                    'error' => FALSE,
                    'data' => array(
                        'pkey' => $id,
                        'code' => $code,
                        'name' => @$name,
                        'email' => @$email
                    ),
                    'message' => 'account created',
                    'code' => 200
                );

            }else{

                $data = array(
                    'error' => TRUE,
                    'message' => 'Something went wrong :(',
                    'code' =>400
                );
            }

        }

        echo json_encode($data);

    }

    public function setCV()
    {
        $postdata = file_get_contents("php://input");
        $request = json_decode($postdata);

        @$id = $request->id;
        @$file = $request->file;

        $save = array(
           $this->table.'.cv_path' => $file,
        );

        $id = $this->modelNameAlias->updateRecord($save, @$id);

        if($id)
        {
            $data = array(
                'error' => FALSE,
                'message' => 'account updated'
            );

        }else{

            $data = array(
                'error' => TRUE,
                'message' => 'Something went wrong :('
            );
        }

        echo json_encode($data);
    }

    public function upldCV()
    {
      $output_dir = $this->cv_up_path;

      if(isset($_FILES["cvFile"]))
      {
          $ret = array();

          $error =$_FILES["cvFile"]["error"];
          //You need to handle  both cases
          //If Any browser does not support serializing of multiple files using FormData()
          if(!is_array($_FILES["cvFile"]["name"])) //single file
          {
              $fileName = $_FILES["cvFile"]["name"];

              $Image1Name = substr(md5(uniqid(rand())),0,15);
              $Image1Name = "DOC-".$Image1Name.strrchr($fileName,".");

              move_uploaded_file($_FILES["cvFile"]["tmp_name"],$output_dir.$Image1Name);
              $ret['file']= $Image1Name;
          }
          else  //Multiple files, file[]
          {
            $fileCount = count($_FILES["cvFile"]["name"]);

            for($i=0; $i < $fileCount; $i++)
            {
              $fileName = $_FILES["cvFile"]["name"][$i];

              $Image1Name = substr(md5(uniqid(rand())),0,15);
              $Image1Name = "IMG-".$Image1Name.strrchr($fileName,".");

              move_uploaded_file($_FILES["cvFile"]["tmp_name"][$i],$output_dir.$Image1Name);
              $ret['file']= $Image1Name;
            }

          }

          echo json_encode($ret);

       }
    }

    public function setPhoto()
    {
        $postdata = file_get_contents("php://input");
        $request = json_decode($postdata);

        @$id = $request->id;
        @$file = $request->file;

        $save = array(
           $this->user_images_table.'.stylist_fk' => $id,
           $this->user_images_table.'.image' => $file,
           $this->user_images_table.'.added_date' => date('Y-m-d h:i:s A')
        );

        $this->modelNameAlias->updateModelPics($save);

        $data = array(
            'error' => FALSE,
            'message' => 'image updated'
        );

        echo json_encode($data);
    }

    public function upldPhotos()
    {
      $output_dir = $this->image_up_path;
      $thumb_dir  = $this->image_thumb_up_path;

      require_once(CLASSES_PATH.'/WideImage/WideImage.php');

      if(isset($_FILES["myfile"]))
      {
          $ret = array();

          $error =$_FILES["myfile"]["error"];
          //You need to handle  both cases
          //If Any browser does not support serializing of multiple files using FormData()
          if(!is_array($_FILES["myfile"]["name"])) //single file
          {
              $fileName = $_FILES["myfile"]["name"];

              $Image1Name = substr(md5(uniqid(rand())),0,15);
              $Image1Name = "IMG-".$Image1Name.strrchr($fileName,".");

              move_uploaded_file($_FILES["myfile"]["tmp_name"],$output_dir.$Image1Name);

              $img = WideImage::load($output_dir.$Image1Name);

              //Thumb Image
              $resized = $img->resize(254, 361, 'fill');
              $resized->saveToFile($thumb_dir.$Image1Name);

              $ret['file']= $Image1Name;
          }
          else  //Multiple files, file[]
          {
            $fileCount = count($_FILES["myfile"]["name"]);

            for($i=0; $i < $fileCount; $i++)
            {
              $fileName = $_FILES["myfile"]["name"][$i];

              $Image1Name = substr(md5(uniqid(rand())),0,15);
              $Image1Name = "IMG-".$Image1Name.strrchr($fileName,".");

              move_uploaded_file($_FILES["myfile"]["tmp_name"][$i],$output_dir.$Image1Name);

              $img = WideImage::load($output_dir.$Image1Name);

              //Thumb Image
              $resized = $img->resize(254, 361);
              $resized->saveToFile($thumb_dir.$Image1Name);

              $ret['file']= $Image1Name;

            }

          }

          echo json_encode($ret);

       }

    }

    public function isAlreadyRegistered($username)
    {
        return $this->modelNameAlias->hasUsername(array('email' =>$username));
    }

    public function send_notification() {

        if(isset($_POST)) {

              $record = $this->modelNameAlias->get_details($_POST['user']);

              if($record) {

                  $language = array();
                  $language_record = $this->modelNameAlias->getLanguageByModel($_POST['user']);

                  foreach ($language_record as $key => $value) {
                     array_push($language, $value->name_en);
                  }

                  $language = (is_array($language)) ? implode(',', $language) : 'Nothing selected';

                  $data_message = array(
                      'Full name' => $record->name,
                      'Phone' => $record->contact_no,
                      'Email address' => $record->email,
                      'City' => $record->city,
                      'Country' => $record->country,

                      'Region' => $record->model_region,
                      'Gender' => $record->model_gender,
                      'Info' => $record->model_info,
                      'Info other' => $record->model_info_other,
                      'Language Spoken' => $language,
                      'Experience' => $record->model_exp,
                      'Marrital Status' => $record->model_marrital_status,
                      'Age' => $record->model_age,
                      'Description' => $record->description
                  );

                  $this->load->library('email');
                  $this->config->load('email', true);
                  $this->email->from('no-reply@avenirevents.com', SITE_NAME);
                  $this->email->to(INFO_EMAIL);
                  $this->email->subject(SITE_NAME . ' - New Stylist has been registered');

                  include_once(MISC_PATH . "/emails.php");
                  $message = $notification_email;

                  $this->email->message($message);

                  //Attach image
                  $photos = $this->modelNameAlias->getStylistPicsByPk($_POST['user']);

                  if(!empty($photos) && is_array($photos)) {

                      foreach ($photos as $key => $value) {
                          $this->email->attach($this->image_up_path . $value->image);
                      }

                  }

                  //Attach CV
                  if($record->cv_path != NULL) {

                      $this->email->attach($this->cv_up_path . $record->cv_path);
                  }

                  //Send email to admin
                  if($this->email->send()) {

                      $data = array('code' => 200, 'message' => 'success', 'data' => array());

                      //Delete user
                      $this->modelNameAlias->deleteRecord($_POST['user']);

                      //Delte all photos uploaded
                      if(!empty($photos) && is_array($photos)) {

                          foreach ($photos as $key => $value) {
                              if(file_exists($this->image_up_path . $value->image)) { unlink($this->image_up_path . $value->image); }
                          }

                      }

                      //Delete CV file uploaded
                      if($record->cv_path != NULL) {
                          if(file_exists($this->cv_up_path . $record->cv_path)) { unlink($this->cv_up_path . $record->cv_path); }
                      }

                  } else {

                      $data = array('code' => 400, 'message' => 'mail error', 'data' => array());
                  }

              }

        }  else  {
            $data = array('code' => 400, 'message' => 'invalid parameters', 'data' => array());
        }

        echo json_encode($data);
    }

}


text:
package oasis.names.tc.wsrp.v1.types;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for BlockingInteractionResponse complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="BlockingInteractionResponse">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="updateResponse" type="{urn:oasis:names:tc:wsrp:v1:types}UpdateResponse" minOccurs="0"/>
 *         <element name="redirectURL" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="extensions" type="{urn:oasis:names:tc:wsrp:v1:types}Extension" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "BlockingInteractionResponse", propOrder = {
    "updateResponse",
    "redirectURL",
    "extensions"
})
public class BlockingInteractionResponse {

    protected UpdateResponse updateResponse;
    protected String redirectURL;
    protected List<Extension> extensions;

    /**
     * Gets the value of the updateResponse property.
     *
     * @return
     *     possible object is
     *     {@link UpdateResponse }
     *
     */
    public UpdateResponse getUpdateResponse() {
        return updateResponse;
    }

    /**
     * Sets the value of the updateResponse property.
     *
     * @param value
     *     allowed object is
     *     {@link UpdateResponse }
     *
     */
    public void setUpdateResponse(UpdateResponse value) {
        this.updateResponse = value;
    }

    /**
     * Gets the value of the redirectURL property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getRedirectURL() {
        return redirectURL;
    }

    /**
     * Sets the value of the redirectURL property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setRedirectURL(String value) {
        this.redirectURL = value;
    }

    /**
     * Gets the value of the extensions property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the extensions property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getExtensions().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link Extension }
     *
     *
     */
    public List<Extension> getExtensions() {
        if (extensions == null) {
            extensions = new ArrayList<Extension>();
        }
        return this.extensions;
    }

}


text:
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding index on 'Page', fields ['order']
        db.create_index('suave_page', ['order'])

        # Adding index on 'Attachment', fields ['order']
        db.create_index('suave_attachment', ['order'])

        # Adding index on 'Carousel', fields ['order']
        db.create_index('suave_carousel', ['order'])

        # Adding index on 'Nav', fields ['order']
        db.create_index('suave_nav', ['order'])

    def backwards(self, orm):
        # Removing index on 'Nav', fields ['order']
        db.delete_index('suave_nav', ['order'])

        # Removing index on 'Carousel', fields ['order']
        db.delete_index('suave_carousel', ['order'])

        # Removing index on 'Attachment', fields ['order']
        db.delete_index('suave_attachment', ['order'])

        # Removing index on 'Page', fields ['order']
        db.delete_index('suave_page', ['order'])

    models = {
        'suave.attachment': {
            'Meta': {'object_name': 'Attachment'},
            'added': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'identifier': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
            'image': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
            'order': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
            'status': ('model_utils.fields.StatusField', [], {'default': "'draft'", 'max_length': '100', 'no_check_for_status': 'True', 'db_index': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'type': ('django.db.models.fields.CharField', [], {'default': "'image'", 'max_length': '45'}),
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
        },
        'suave.carousel': {
            'Meta': {'object_name': 'Carousel'},
            'added': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'identifier': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
            'order': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
            'status': ('model_utils.fields.StatusField', [], {'default': "'draft'", 'max_length': '100', 'no_check_for_status': 'True', 'db_index': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
        },
        'suave.carouselimage': {
            'Meta': {'object_name': 'CarouselImage'},
            'carousel': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['suave.Carousel']"}),
            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'image': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'})
        },
        'suave.nav': {
            'Meta': {'object_name': 'Nav'},
            'added': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'identifier': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
            'items': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'navs'", 'symmetrical': 'False', 'through': "orm['suave.NavItem']", 'to': "orm['suave.Page']"}),
            'order': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
            'status': ('model_utils.fields.StatusField', [], {'default': "'draft'", 'max_length': '100', 'no_check_for_status': 'True', 'db_index': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
        },
        'suave.navitem': {
            'Meta': {'ordering': "['order']", 'object_name': 'NavItem'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'nav': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'navitems'", 'to': "orm['suave.Nav']"}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'page': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'navitems'", 'to': "orm['suave.Page']"}),
            'show_children': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'suave.page': {
            'Meta': {'ordering': "['order']", 'object_name': 'Page'},
            'added': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'body': ('ckeditor.fields.RichTextField', [], {'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'identifier': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
            'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
            'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
            'order': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
            'parent': ('mptt.fields.TreeForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['suave.Page']"}),
            'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255'}),
            'status': ('model_utils.fields.StatusField', [], {'default': "'draft'", 'max_length': '100', 'no_check_for_status': 'True', 'db_index': 'True'}),
            'template_override': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
            'url': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
        }
    }

    complete_apps = ['suave']


text:
function Get-IEXTip
{

 param(
  $number = $null,
  [switch]$Online
 )

 trap
 {
  continue
 }

 if ($Online) {
  (New-Object -com shell.application).Open('http://technet.microsoft.com/en-us/library/bb397216.aspx')
  return
 }

     $exbin = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Exchange\Setup).MsiInstallPath + "bin"

 if( ($exrandom -eq $null) -or ($exrandom -isnot [System.Random]))
 {
  $exrandom = New-Object System.Random
 }

     $exchculture = (Get-UICulture).Parent.Name

 if ( Test-Path "$exbin\$exchculture\extips.xml" )
 {
  $exchculture = $exchculture
 }
 else
 {
  $exchculture = 'en'
 }

 if (Test-Path "$exbin\$exchculture\extips.xml")
 {

  $tips = [xml](get-content "$exbin\$exchculture\extips.xml")
  if($number -eq $null)
  {
   $temp = $exrandom.Next( 0, $tips.topic.developerConceptualDocument.introduction.table.row.Count )
   write-host -fore Yellow ( "Tip of the day #" + $temp + ":`n" )
   $nav = $tips.topic.developerConceptualDocument.introduction.table.row[$temp].entry.CreateNavigator()
   $null =  $nav.MoveToFirstChild()

   do
   {
    write-host $nav.Value
   }
   while( $nav.MoveToNext() )
   write-host
  }
  else
  {
   $nav = $tips.topic.developerConceptualDocument.introduction.table.row[$number].entry.CreateNavigator()
   write-host -fore Yellow ( "Tip of the day #" + $number + ":`n" )
             $null = $nav.MoveToFirstChild()

   do
   {
    write-host $nav.Value
   }
   while( $nav.MoveToNext() )
   Write-Host
  }
 }
 else
 {
         "Exchange tips file '$exbin\$exchculture\extips.xml' not found!"
 }
}


text:
import Vue from 'vue'
import Router from 'vue-router'
import progress from 'nprogress'
import ga from 'vue-ga'

Vue.use(Router)

const EditorPage = () => import(/* webpackChunkName: "editor-page" */ '@/views/EditorPage.vue')
const NotFound = () => import(/* webpackChunkName: "not-found-page" */ '@/views/NotFound.vue')
const GitHubSuccess = () => import(/* webpackChunkName: "ghlogin-result" */ '@/views/GitHubSuccess.vue')

const router = new Router({
  mode: 'history',
  routes: [
    {
      name: 'home',
      path: '/',
      component: EditorPage
    },
    {
      name: 'gist',
      path: '/gist/:gist',
      component: EditorPage
    },
    {
      name: 'boilerplate',
      path: '/boilerplate/:boilerplate',
      component: EditorPage
    },
    {
      name: 'github-success',
      path: '/github_success',
      component: GitHubSuccess
    },
    {
      path: '*',
      component: NotFound
    }
  ]
})

ga(router, 'UA-54857209-13')

router.beforeEach((to, from, next) => {
  progress.start()
  next()
})

export default router


text:
package test.gov.nih.nci.cacoresdk.domain.other.primarykey;

import gov.nih.nci.cacoresdk.domain.other.primarykey.DoubleKey;
import gov.nih.nci.system.applicationservice.ApplicationException;
import gov.nih.nci.system.query.cql.CQLAttribute;
import gov.nih.nci.system.query.cql.CQLObject;
import gov.nih.nci.system.query.cql.CQLPredicate;
import gov.nih.nci.system.query.cql.CQLQuery;

import java.util.Collection;
import java.util.Iterator;

import test.gov.nih.nci.cacoresdk.SDKTestBase;

public class DoubleKeyTest extends SDKTestBase
{
	public static String getTestCaseName()
	{
		return "Double Key Test Case";
	}

	/**
	 * Uses Nested Search Criteria for search
	 * Verifies that the results are returned
	 * Verifies size of the result set
	 * Verifies that none of the attribute is null
	 *
	 * @throws ApplicationException
	 */
	public void testEntireObjectNestedSearch() throws ApplicationException
	{
		DoubleKey searchObject = new DoubleKey();
		Collection results = getApplicationService().search("gov.nih.nci.cacoresdk.domain.other.primarykey.DoubleKey",searchObject );

		assertNotNull(results);
		assertEquals(5,results.size());

		for(Iterator i = results.iterator();i.hasNext();)
		{
			DoubleKey result = (DoubleKey)i.next();
			assertNotNull(result);
			assertNotNull(result.getId());
			assertNotNull(result.getName());
		}
	}

	/**
	 * Uses Class for search
	 * Searches by the primary key
	 * Verifies size of the result set
	 *
	 * @throws ApplicationException
	 */
	public void testPrimaryKeyNestedSearch() throws ApplicationException
	{
		DoubleKey searchObject = new DoubleKey();
		searchObject.setId(new Double(1.1));
		Collection results = getApplicationService().search(DoubleKey.class,searchObject );

		assertNotNull(results);
		assertEquals(1,results.size());
	}

	/**
	 * Uses CQL for search
	 * Searches by the Double data type
	 * Verifies size of the result set
	 *
	 * @throws ApplicationException
	 */
	public void testPrimaryKeyCQL() throws ApplicationException
	{
		CQLQuery criteria = new CQLQuery();

		CQLObject object = new CQLObject();
		object.setName("gov.nih.nci.cacoresdk.domain.other.primarykey.DoubleKey");
		object.setAttribute(new CQLAttribute("id",CQLPredicate.EQUAL_TO,"1.1"));
		criteria.setTarget(object);

		Collection results = getApplicationService().query(criteria, "gov.nih.nci.cacoresdk.domain.other.primarykey.DoubleKey");

		assertNotNull(results);
		assertEquals(1,results.size());
	}

}


text:
goog.provide('rep.Attribute');
goog.provide('rep.DerivedAttribute');
goog.provide('rep.Model');

goog.require('rep.Emitter');

/**
 * Provides the basic reactive model and attribute functionality.
 * @see backbone.js for inspiration.
 *
 *

 * TODO(gregp): how might we listen to *all* events again?
 *

 * TODO(gregp): rep.Model.prototype.unset
 *

 * TODO(gregp): rep.Model.prototype.defaults
 *

 * TODO(gregp): better recursive heierarchies
 *

 * TODO(gregp): rep.Set/rep.Array (un)ordered collections
 *
 * @constructor
 * @extends {rep.Emitter}
 */
rep.Model = function() {
  goog.base(this);

  /**
   * Map attribute UIDs to values.
   * @type {Object.<number, *>}
   */
  this.values_ = {};

  /**
   * Map closure object uid to attribute objects.
   * @type {Object.<number, rep.Attribute>}
   */
  this.attributes_ = {};

  this.init_();
};
goog.inherits(rep.Model, rep.Emitter);

/**
 * Initialize the reactive model:
 * For each property, determine which ones are attributes,
 *  and add them to this.attributes_.
 * @private
 */
rep.Model.prototype.init_ = function() {
  for (var key in this) {
    var val = this[key];
    if (val instanceof rep.Attribute) {
      var uid = goog.getUid(val);
      this.attributes_[uid] = val;
    }
  }
};

/**
 * Returns the last set value for the given attribute,
 *  or the current calculated value if the attribute is derived.
 * @param {rep.Attribute} attr, the attribute to get
 * @return {*} value of the given attribute
 */
rep.Model.prototype.get = function(attr) {
    var uid = goog.getUid(attr);
    if (attr instanceof rep.DerivedAttribute) {
      this.values_[uid] = attr.compute(this);
    }
    return this.values_[uid];
};

/**
 * Sets the value of the given attribute on this model.
 *

 * Dispatches the attribute's set event.
 *
 * @param {rep.Attribute} attr
 * @param {*} value
 */
rep.Model.prototype.set = function(attr, value) {
  var uid = goog.getUid(attr);
  var prior = this.values_[uid];
  this.values_[uid] = value;
  // TODO(gregp): bubble submodel events
  // if (value instanceof rep.Model) {
  //   value.setParentEventTarget(this);
  // }
  this.dispatchEvent({
    type: attr.set,
    prior: prior,
    value: value
  });
};

/**
 * Set the given {@link rep.Attribute}, but only if the given value
 *  is defined and not null.
 *

 * Generally used in a constructor, or anywhere else we might get an
 *  optional parameter.
 *
 * @param {rep.Attribute} attr
 * @param {*=} opt_value
 */
rep.Model.prototype.define = function(attr, opt_value) {
  if (goog.isDefAndNotNull(opt_value)) {
    this.set(attr, opt_value);
  }
};

/**
 * Returns all the attributes defined on this model.
 * @return {Array.<rep.Attribute>}
 * @private
 */
rep.Model.prototype.getAttributes_ = function() {
  return goog.object.getValues(this.attributes_);
};

/**
 * Converts the model to JSON by finding all attributes
 *  which have a key property, then assigning their value to that key.
 *

 * Note that the function name is somewhat of a misnomer, as we are not
 *  actually exporting *JSON*, but instead are exporting something that can be
 *  easily converted to JSON when implemented properly on subclasses.
 *

 * To fulfill this contract, subclasses must make sure that
 *  any rep.Attribute whose jsonKey has been set is one of the following:
 *  (1) a string
 *  (2) a number
 *  (3) null,
 *  (4) an object with a toJson() function
 *  (5) an object whose properties all satisfy one of these conditions or
 *  (6) an array whose properties all satisfy one of these conditions.
 *

 * It will generally break advanced optimizations assumptions,
 *  as it essentially exports objects to bracket-notation.
 *

 * Thus it should be used only to generate data objects for HTTP APIs
 *  or non-closure-compiled javascript code.
 *

 * Importantly, it should not be used in an attempt to pass data to soy,
 *  or to hack around otherwise clumsy-feeling class interfaces.
 *

 * The convention for soy is to use a model-class specific toSoyData()
 *  function, which creates and returns dot-notation objects
 *  using calls to get() for each rep.Attribute needed on that object.
 *
 * @return {Object}
 */
rep.Model.prototype.toJson = function() {
  var json = {};
  goog.array.forEach(this.getAttributes_(), function(attr){
    if (attr.key) {
      var cur = this.get(attr);
      if (!goog.isDef(cur)) {
        return;
      }
      if (goog.isFunction(cur.toJson)) {
        // TODO(gregp): handle recursive model heierarchies better?
        cur = cur.toJson();
      }
      json[attr.key] = cur;
    }
  }, this);
  return json;
};

/**
 * Listens for when a given attribute is set on this model.
 * @param {rep.Attribute} attr
 * @param {Function} fn
 * @param {Object=} opt_binder
 */
rep.Model.prototype.onSet = function(attr, fn, opt_binder) {
  return this.on(attr.set, fn, opt_binder);
};

/**
 * Listens for when a given attribute *changes* value.
 * @param {rep.Attribute} attr
 * @param {Function} fn
 * @param {Object=} opt_binder
 */
rep.Model.prototype.onChange = function(attr, fn, opt_binder) {
  return this.on(attr.set, function(ev) {
    if (ev.prior != ev.value) {
      fn(ev);
    }
  }, opt_binder);
};

/**
 * The base class for an attribute on a rep.Model.
 * @constructor
 */
rep.Attribute = function() {
  this.set = rep.Attribute.SET_EVENT + goog.getUid(this);
};

/** @type {!string} */
rep.Attribute.SET_EVENT = 'rep_set__';

/**
 * The key used when converting this Attribute's value to a bracket
 *  notation property on an object for export.
 *

 * TODO(gregp): probably should be setJsonKey()
 *
 * @param {string=} jsonKey
 * @return {rep.Attribute}
 */
rep.Attribute.prototype.jsonKey = function(jsonKey) {
  this.key = jsonKey;
  return this;
};

/**
 * An attribute that is derived from other attributes on the rep.Model.
 *
 * @param {function(rep.Model)} computationFn which accepts the rep.Model
 *  and recomputes its appropriate value accordingly.
 * @constructor
 * @extends {rep.Attribute}
 */
rep.DerivedAttribute = function(computationFn) {
  goog.base(this);
  this.compute = computationFn;
};
goog.inherits(rep.DerivedAttribute, rep.Attribute);


text:
<?php

namespace Drupal\block_content\Tests\Views;

/**
 * Tests the redirect destination on block content on entity operations.
 *
 * @group block_content
 */
class BlockContentRedirectTest extends BlockContentTestBase {

  /**
   * Views used by this test.
   *
   * @var array
   */
  public static $testViews = ['test_block_content_redirect_destination'];

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = array('block', 'block_content', 'views');

  /**
   * Tests the redirect destination when editing block content.
   */
  public function testRedirectDestination() {
    $this->drupalLogin($this->drupalCreateUser(array('administer blocks')));
    $this->drupalGet('admin/structure/block/block-content');

    // Create a custom block.
    $this->clickLink('custom block');
    $edit = array();
    $edit['info[0][value]'] = 'Test redirect destination';
    $edit['body[0][value]'] = $this->randomMachineName(16);
    $this->drupalPostForm(NULL, $edit, 'Save');

    // Check the block content is present in the view redirect destination.
    $this->drupalGet('admin/content/redirect_destination');
    $this->assertText('Test redirect destination');

    // Edit the created block and save.
    $this->clickLink('Edit');
    $this->drupalPostForm(NULL, [], 'Save');
    $this->assertUrl('admin/content/redirect_destination');
  }

}


text:
package jxl.write.biff;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

/**
 * The list of available shared strings.  This class contains
 * the labels used for the entire spreadsheet
 */
class SharedStrings
{
  /**
   * All the strings in the spreadsheet, keyed on the string itself
   */
  private HashMap strings;

  /**
   * Contains the same strings, held in a list
   */
  private ArrayList stringList;

  /**
   * The total occurrence of strings in the workbook
   */
  private int totalOccurrences;

  /**
   * Constructor
   */
  public SharedStrings()
  {
    strings = new HashMap(100);
    stringList = new ArrayList(100);
    totalOccurrences = 0;
  }

  /**
   * Gets the index for the string passed in.  If the string is already
   * present, then returns the index of that string, otherwise
   * creates a new key-index mapping
   *
   * @param s the string whose index we want
   * @return the index of the string
   */
  public int getIndex(String s)
  {
    Integer i = (Integer) strings.get(s);

    if (i == null)
    {
      i = new Integer(strings.size());
      strings.put(s, i);
      stringList.add(s);
    }

    totalOccurrences++;

    return i.intValue();
  }

  /**
   * Gets the string at the specified index
   *
   * @param i the index of the string
   * @return the string at the specified index
   */
  public String get(int i)
  {
    return (String) stringList.get(i);
  }

  /**
   * Writes out the shared string table
   *
   * @param outputFile the binary output file
   * @exception IOException
   */
  public void write(File outputFile) throws IOException
  {
    // Thanks to Guenther for contributing the ExtSST implementation portion
    // of this method
    int charsLeft = 0;
    String curString = null;
    SSTRecord sst = new SSTRecord(totalOccurrences, stringList.size());
    ExtendedSSTRecord extsst = new ExtendedSSTRecord(stringList.size());
    int bucketSize = extsst.getNumberOfStringsPerBucket();

    Iterator i = stringList.iterator();
    int stringIndex = 0;
    while (i.hasNext() && charsLeft == 0)
    {
      curString = (String) i.next();
      // offset + header bytes
      int relativePosition = sst.getOffset() + 4;
      charsLeft = sst.add(curString);
      if ((stringIndex % bucketSize) == 0) {
        extsst.addString(outputFile.getPos(), relativePosition);
      }
      stringIndex++;
    }
    outputFile.write(sst);

    if (charsLeft != 0 || i.hasNext())
    {
      // Add the remainder of the string to the continue record
      SSTContinueRecord cont = createContinueRecord(curString,
                                                    charsLeft,
                                                    outputFile);

      // Carry on looping through the array until all the strings are done
      while (i.hasNext())
      {
        curString = (String) i.next();
        int relativePosition = cont.getOffset() + 4;
        charsLeft = cont.add(curString);
        if ((stringIndex % bucketSize) == 0) {
          extsst.addString(outputFile.getPos(), relativePosition);
        }
        stringIndex++;

        if (charsLeft != 0)
        {
          outputFile.write(cont);
          cont = createContinueRecord(curString, charsLeft, outputFile);
        }
      }

      outputFile.write(cont);
    }

    outputFile.write(extsst);
  }

  /**
   * Creates and returns a continue record using the left over bits and
   * pieces
   */
  private SSTContinueRecord createContinueRecord
    (String curString, int charsLeft, File outputFile) throws IOException
  {
    // Set up the remainder of the string in the continue record
    SSTContinueRecord cont = null;
    while (charsLeft != 0)
    {
      cont = new SSTContinueRecord();

      if (charsLeft == curString.length()  || curString.length() == 0)
      {
        charsLeft = cont.setFirstString(curString, true);
      }
      else
      {
        charsLeft = cont.setFirstString
          (curString.substring(curString.length() - charsLeft), false);
      }

      if (charsLeft != 0)
      {
        outputFile.write(cont);
        cont = new SSTContinueRecord();
      }
    }

    return cont;
  }
}


text:
package org.yukung.sandbox.http.socket;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.yukung.sandbox.http.HttpClient;

import static org.assertj.core.api.Assertions.*;

/**
 * @author yukung
 */
public class SocketHttpClientTest {

    private HttpClient client;

    @Before
    public void setUp() throws Exception {
        client = new SocketHttpClient();
    }

    @After
    public void tearDown() throws Exception {
        client.close();
    }

    @Test
    public void get() throws Exception {
        String response = client.get("http://localhost:8080/get?param=value");
        assertThat(response).contains(
                "Accessed URL = /get?param=value",
                "Accessed Method = GET",
                "Accessed Date = ");
    }

    @Test
    public void post() throws Exception {
        String body = "POST Body" + "\r\n" +
                "Hello Http Server!" + "\r\n";

        String response = client.post("http://localhost:8080/post", body);
        assertThat(response).contains(
                "Accessed URL = /post",
                "Accessed Method = POST",
                "Accessed Date =",
                "Request Body<<",
                "POST Body",
                "Hello Http Server!",
                ">>");
    }

}


text:
package userInterface.uiobject;

import javafx.animation.Timeline;
import javafx.scene.Node;
import javafx.scene.control.Slider;

public class SpeedSlider {
    /**
     * SpeedSlider creates a Slider that allows the user to control
     * the speeds of simulation.

     *
     * TODO: add methods to position slider
     *
     * @author Nathan Prabhu
     */
    private final int MIN_FRAMERATE_MULTIPLIER = 0;
    private final int MAX_FRAMERATE_MULTIPLIER = 3;
    private final int DEFAULT_FRAMERATE_MULTIPLIER = 1;

    private Slider slider;

    public SpeedSlider (Timeline t) {
        slider = new Slider(MIN_FRAMERATE_MULTIPLIER,
                            MAX_FRAMERATE_MULTIPLIER, DEFAULT_FRAMERATE_MULTIPLIER);
        slider.valueProperty().addListener( (ov, oldValue, newValue) ->
                                           changeSpeed(t, (double) newValue));
        slider.setShowTickMarks(true);
        //slider.set
        slider.setMajorTickUnit(1);
        slider.setShowTickLabels(true);
    }

    private void changeSpeed (Timeline t, double newValue) {
        t.setRate(newValue);
    }

    /**
     * Returns slider node to be added to a group.
     */
    public Node getNode () {
        return slider;
    }
}


text:
#include <aws/ssm/model/SessionManagerOutputUrl.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace SSM
{
namespace Model
{

SessionManagerOutputUrl::SessionManagerOutputUrl() :
    m_s3OutputUrlHasBeenSet(false),
    m_cloudWatchOutputUrlHasBeenSet(false)
{
}

SessionManagerOutputUrl::SessionManagerOutputUrl(JsonView jsonValue) :
    m_s3OutputUrlHasBeenSet(false),
    m_cloudWatchOutputUrlHasBeenSet(false)
{
  *this = jsonValue;
}

SessionManagerOutputUrl& SessionManagerOutputUrl::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("S3OutputUrl"))
  {
    m_s3OutputUrl = jsonValue.GetString("S3OutputUrl");

    m_s3OutputUrlHasBeenSet = true;
  }

  if(jsonValue.ValueExists("CloudWatchOutputUrl"))
  {
    m_cloudWatchOutputUrl = jsonValue.GetString("CloudWatchOutputUrl");

    m_cloudWatchOutputUrlHasBeenSet = true;
  }

  return *this;
}

JsonValue SessionManagerOutputUrl::Jsonize() const
{
  JsonValue payload;

  if(m_s3OutputUrlHasBeenSet)
  {
   payload.WithString("S3OutputUrl", m_s3OutputUrl);

  }

  if(m_cloudWatchOutputUrlHasBeenSet)
  {
   payload.WithString("CloudWatchOutputUrl", m_cloudWatchOutputUrl);

  }

  return payload;
}

} // namespace Model
} // namespace SSM
} // namespace Aws