text:
#pragma once
#include <aws/storagegateway/StorageGateway_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/storagegateway/model/FileSystemAssociationInfo.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Json
{
  class JsonValue;
} // namespace Json
} // namespace Utils
namespace StorageGateway
{
namespace Model
{
  class AWS_STORAGEGATEWAY_API DescribeFileSystemAssociationsResult
  {
  public:
    DescribeFileSystemAssociationsResult();
    DescribeFileSystemAssociationsResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
    DescribeFileSystemAssociationsResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);

    /**
     *
An array containing the FileSystemAssociationInfo data type of
     * each file system association to be described.

     */
    inline const Aws::Vector<FileSystemAssociationInfo>& GetFileSystemAssociationInfoList() const{ return m_fileSystemAssociationInfoList; }

    /**
     *
An array containing the FileSystemAssociationInfo data type of
     * each file system association to be described.

     */
    inline void SetFileSystemAssociationInfoList(const Aws::Vector<FileSystemAssociationInfo>& value) { m_fileSystemAssociationInfoList = value; }

    /**
     *
An array containing the FileSystemAssociationInfo data type of
     * each file system association to be described.

     */
    inline void SetFileSystemAssociationInfoList(Aws::Vector<FileSystemAssociationInfo>&& value) { m_fileSystemAssociationInfoList = std::move(value); }

    /**
     *
An array containing the FileSystemAssociationInfo data type of
     * each file system association to be described.

     */
    inline DescribeFileSystemAssociationsResult& WithFileSystemAssociationInfoList(const Aws::Vector<FileSystemAssociationInfo>& value) { SetFileSystemAssociationInfoList(value); return *this;}

    /**
     *
An array containing the FileSystemAssociationInfo data type of
     * each file system association to be described.

     */
    inline DescribeFileSystemAssociationsResult& WithFileSystemAssociationInfoList(Aws::Vector<FileSystemAssociationInfo>&& value) { SetFileSystemAssociationInfoList(std::move(value)); return *this;}

    /**
     *
An array containing the FileSystemAssociationInfo data type of
     * each file system association to be described.

     */
    inline DescribeFileSystemAssociationsResult& AddFileSystemAssociationInfoList(const FileSystemAssociationInfo& value) { m_fileSystemAssociationInfoList.push_back(value); return *this; }

    /**
     *
An array containing the FileSystemAssociationInfo data type of
     * each file system association to be described.

     */
    inline DescribeFileSystemAssociationsResult& AddFileSystemAssociationInfoList(FileSystemAssociationInfo&& value) { m_fileSystemAssociationInfoList.push_back(std::move(value)); return *this; }

  private:

    Aws::Vector<FileSystemAssociationInfo> m_fileSystemAssociationInfoList;
  };

} // namespace Model
} // namespace StorageGateway
} // namespace Aws

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
     <item>
        <shape  android:shape="rectangle">
            <solid android:color="#BBB" />
            <corners android:radius="5dp" />
        </shape>
    </item>

    <!-- White Top color -->
    <item android:bottom="3px">
        <shape  android:shape="rectangle">
             <solid android:color="#ffffff" />
             <corners android:radius="1dp" />
             <padding
                android:top="1dp"
                android:right="1dp"
                android:bottom="1dp"
                android:left="1dp"/>
        </shape>
    </item>

</layer-list>


text:
using Thriot.Framework.Azure.DataAccess;
using Thriot.Framework.Azure.TableOperations;
using Thriot.Framework.Exceptions;
using Thriot.Objects.Model;
using Thriot.Objects.Model.Operations;
using Thriot.Objects.Operations.Azure.DataAccess;

namespace Thriot.Objects.Operations.Azure
{
    public class CompanyOperations : IPersistedCompanyOperations
    {
        private readonly ITableEntityOperation _tableEntityOperation;

        public CompanyOperations(ICloudStorageClientFactory cloudStorageClientFactory)
        {
            _tableEntityOperation = cloudStorageClientFactory.GetTableEntityOperation();
        }

        public Company Get(string id)
        {
            var companyKey = PartionKeyRowKeyPair.CreateFromIdentity(id);

            var companyRepository = new CompanyRepository(_tableEntityOperation);

            var companyTableEntity = companyRepository.Get(companyKey);

            if (companyTableEntity == null)
                throw new NotFoundException();

            return new Company
            {
                Id = id,
                TelemetryDataSinkSettings = companyTableEntity.TelemetryDataSinkSettings
            };
        }
    }
}


text:
package ch.nana.calendar;

import java.util.List;

import com.google.api.server.spi.config.Api;
import com.google.api.server.spi.config.ApiMethod;
import com.google.api.server.spi.config.ApiNamespace;
import com.google.appengine.api.datastore.EntityNotFoundException;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.users.User;

import ch.nana.calendar.entity.EventTemplate;

/** An endpoint class we are exposing */
@Api(name = "calApi",
     version = "v1",
     scopes = {Constants.EMAIL_SCOPE, Constants.CALENDAR_SCOPE},
     clientIds = {Constants.WEB_CLIENT_ID, com.google.api.server.spi.Constant.API_EXPLORER_CLIENT_ID},
     namespace = @ApiNamespace(ownerDomain = "calendarizator.appspot.com",
                                ownerName = "calendarizator.appspot.com"))
public class CalendarizatorAPI {

	private TemplateStore ts = new TemplateStore();

	@ApiMethod(name = "template.list")
	public List<EventTemplate> getTemplates(User user){
		TemplateStore ts = new TemplateStore();
		 return ts.getTemplates(user);
	}

	@ApiMethod(name = "template.get")
	public EventTemplate getTemplate(User user, Key id) throws EntityNotFoundException{
		TemplateStore ts = new TemplateStore();
		 return ts.getTemplate(user, id);
	}

	@ApiMethod(name = "template.save", httpMethod="POST")
	public Key saveTempate(EventTemplate template, User user){
		return ts.storeTemplate(template, user);
	}

}


text:
package com.aspose.slides.examples.charts;

import com.aspose.slides.Chart;
import com.aspose.slides.ChartType;
import com.aspose.slides.Presentation;
import com.aspose.slides.SaveFormat;
import com.aspose.slides.examples.RunExamples;

public class GetWidthHeightFromChartPlotArea
{
    public static void main(String[] args)
    {
        //ExStart:GetWidthHeightFromChartPlotArea
        // The path to the documents directory.
        String dataDir = RunExamples.getDataDir_Charts();

        Presentation pres = new Presentation(dataDir + "test.Pptx");
        try
        {
            Chart chart = (Chart) pres.getSlides().get_Item(0).getShapes().addChart(ChartType.ClusteredColumn, 100, 100, 500, 350);
            chart.validateChartLayout();

            double x = chart.getPlotArea().getActualX();
            double y = chart.getPlotArea().getActualY();
            double w = chart.getPlotArea().getActualWidth();
            double h = chart.getPlotArea().getActualHeight();

            // Save presentation with chart
            pres.save(dataDir + "Chart_out.pptx", SaveFormat.Pptx);
        }
        finally
        {
            if (pres != null) pres.dispose();
        }

        //ExEnd:GetWidthHeightFromChartPlotArea
    }
}


text:
Projects for CTEC 3350-001

This Repo includes both major projects for CTEC 3350 using the JavaJam Mock Company.

1. - Responsive Visual Style Guide
2. - JavaJam Website


text:
<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $this->call(TalksSeeder::class);
    }
}


text:
import { indexForItem, findReorderItem } from './item-reorder-util';
import { pointerCoord } from '../../util/dom';
import { UIEventManager } from '../../gestures/ui-event-manager';
/**
 * @hidden
 */
export class ItemReorderGesture {
    /**
     * @param {?} plt
     * @param {?} reorderList
     */
    constructor(plt, reorderList) {
        this.plt = plt;
        this.reorderList = reorderList;
        this.selectedItemEle = null;
        this.events = new UIEventManager(plt);
        this.events.pointerEvents({
            element: this.reorderList.getNativeElement(),
            pointerDown: this.onDragStart.bind(this),
            pointerMove: this.onDragMove.bind(this),
            pointerUp: this.onDragEnd.bind(this),
            zone: false
        });
    }
    /**
     * @param {?} ev
     * @return {?}
     */
    onDragStart(ev) {
        if (this.selectedItemEle) {
            return false;
        }
        let /** @type {?} */ reorderElement = ev.target;
        if (reorderElement.nodeName !== 'ION-REORDER') {
            return false;
        }
        let /** @type {?} */ reorderMark = reorderElement['$ionComponent'];
        if (!reorderMark) {
            console.error('ion-reorder does not contain $ionComponent');
            return false;
        }
        this.reorderList._reorderPrepare();
        let /** @type {?} */ item = reorderMark.getReorderNode();
        if (!item) {
            console.error('reorder node not found');
            return false;
        }
        ev.preventDefault();
        // Preparing state
        this.selectedItemEle = item;
        this.selectedItemHeight = item.offsetHeight;
        this.lastYcoord = -100;
        this.lastToIndex = indexForItem(item);
        this.windowHeight = this.plt.height() - AUTO_SCROLL_MARGIN;
        this.lastScrollPosition = this.reorderList._scrollContent(0);
        this.offset = pointerCoord(ev);
        this.offset.y += this.lastScrollPosition;
        item.classList.add(ITEM_REORDER_ACTIVE);
        this.reorderList._reorderStart();
        return true;
    }
    /**
     * @param {?} ev
     * @return {?}
     */
    onDragMove(ev) {
        let /** @type {?} */ selectedItem = this.selectedItemEle;
        if (!selectedItem) {
            return;
        }
        ev.preventDefault();
        // Get coordinate
        let /** @type {?} */ coord = pointerCoord(ev);
        let /** @type {?} */ posY = coord.y;
        // Scroll if we reach the scroll margins
        let /** @type {?} */ scrollPosition = this.scroll(posY);
        // Only perform hit test if we moved at least 30px from previous position
        if (Math.abs(posY - this.lastYcoord) > 30) {
            let /** @type {?} */ overItem = this.itemForCoord(coord);
            if (overItem) {
                let /** @type {?} */ toIndex = indexForItem(overItem);
                if (toIndex !== undefined && (toIndex !== this.lastToIndex || this.emptyZone)) {
                    let /** @type {?} */ fromIndex = indexForItem(selectedItem);
                    this.lastToIndex = toIndex;
                    this.lastYcoord = posY;
                    this.emptyZone = false;
                    this.reorderList._reorderMove(fromIndex, toIndex, this.selectedItemHeight);
                }
            }
            else {
                this.emptyZone = true;
            }
        }
        // Update selected item position
        let /** @type {?} */ ydiff = Math.round(posY - this.offset.y + scrollPosition);
        ((selectedItem.style))[this.plt.Css.transform] = `translateY(${ydiff}px)`;
    }
    /**
     * @param {?} ev
     * @return {?}
     */
    onDragEnd(ev) {
        let /** @type {?} */ selectedItem = this.selectedItemEle;
        if (!selectedItem) {
            return;
        }
        if (ev) {
            ev.preventDefault();
            ev.stopPropagation();
        }
        let /** @type {?} */ toIndex = this.lastToIndex;
        let /** @type {?} */ fromIndex = indexForItem(selectedItem);
        let /** @type {?} */ reorderInactive = () => {
            this.selectedItemEle.style.transition = '';
            this.selectedItemEle.classList.remove(ITEM_REORDER_ACTIVE);
            this.selectedItemEle = null;
        };
        if (toIndex === fromIndex) {
            selectedItem.style.transition = 'transform 200ms ease-in-out';
            setTimeout(reorderInactive, 200);
        }
        else {
            reorderInactive();
        }
        this.reorderList._reorderEmit(fromIndex, toIndex);
    }
    /**
     * @param {?} coord
     * @return {?}
     */
    itemForCoord(coord) {
        const /** @type {?} */ sideOffset = this.plt.isRTL ? 100 : -100;
        const /** @type {?} */ x = this.offset.x + sideOffset;
        const /** @type {?} */ y = coord.y;
        const /** @type {?} */ element = this.plt.getElementFromPoint(x, y);
        return findReorderItem(element, this.reorderList.getNativeElement());
    }
    /**
     * @param {?} posY
     * @return {?}
     */
    scroll(posY) {
        if (posY < AUTO_SCROLL_MARGIN) {
            this.lastScrollPosition = this.reorderList._scrollContent(-SCROLL_JUMP);
        }
        else if (posY > this.windowHeight) {
            this.lastScrollPosition = this.reorderList._scrollContent(SCROLL_JUMP);
        }
        return this.lastScrollPosition;
    }
    /**
     * @hidden
     * @return {?}
     */
    destroy() {
        this.onDragEnd(null);
        this.events.destroy();
        this.events = null;
        this.reorderList = null;
    }
}
function ItemReorderGesture_tsickle_Closure_declarations() {
    /** @type {?} */
    ItemReorderGesture.prototype.selectedItemEle;
    /** @type {?} */
    ItemReorderGesture.prototype.selectedItemHeight;
    /** @type {?} */
    ItemReorderGesture.prototype.offset;
    /** @type {?} */
    ItemReorderGesture.prototype.lastToIndex;
    /** @type {?} */
    ItemReorderGesture.prototype.lastYcoord;
    /** @type {?} */
    ItemReorderGesture.prototype.lastScrollPosition;
    /** @type {?} */
    ItemReorderGesture.prototype.emptyZone;
    /** @type {?} */
    ItemReorderGesture.prototype.windowHeight;
    /** @type {?} */
    ItemReorderGesture.prototype.events;
    /** @type {?} */
    ItemReorderGesture.prototype.plt;
    /** @type {?} */
    ItemReorderGesture.prototype.reorderList;
}
const /** @type {?} */ AUTO_SCROLL_MARGIN = 60;
const /** @type {?} */ SCROLL_JUMP = 10;
const /** @type {?} */ ITEM_REORDER_ACTIVE = 'reorder-active';
//# sourceMappingURL=item-reorder-gesture.js.map


text:
"""Adds indices to databases which require them."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import argparse
import sqlite3

def main(db_name):
  with open('data_utils/extra_' + db_name + '_indices.txt') as infile:
    indices = infile.read().split('\n')

  db = sqlite3.connect('databases/' + db_name + '.db')
  c = db.cursor()

  for index in indices:
    print('Adding index:')
    print(index)
    q = index
    c.execute(q)
    db.commit()

  db.close()

if __name__ == '__main__':
  parser = argparse.ArgumentParser()
  parser.add_argument(
      '--database_name', type=str, help='The database to add indices to.')
  args = parser.parse_args()
  main(args.database_name)


text:
#include <errno.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
typedef struct Node * pNode;
typedef pNode List;
typedef pNode ListPos;
typedef struct ElementType
{
    int no;
}ElementType;
typedef struct Node
{
    pNode prior;
    ElementType element;
    pNode next;
}Node;

pNode listCreate ( ElementType newelement );
int printElement ( ElementType element );
ListPos listInsert ( ListPos pos,ElementType newelement );
int elementcmp ( ElementType elementOne,ElementType elementTwo );
int listGetLen ( List list );
int listDelete ( List list,ElementType delElement );
ListPos listFind ( List list,ElementType findElement );
int listWalkOrder ( List list,int (*walkWay)(ElementType ele) );
int listWalkReverse ( List list,int (*walkWay)(ElementType ele) );
List listSort ( List list );

int printElement ( ElementType element )
{
    printf("%d\n",element.no);
    return 0;
}		/* -----  end of function printElement  ----- */

int elementcmp ( ElementType elementOne,ElementType elementTwo )
{
    if(elementOne.no==elementTwo.no)
    {
        return 0;
    }
    else if(elementOne.no>elementTwo.no)
    {
        return 1;
    }
    else
    {
        return -1;
    }
}		/* -----  end of function elementcmp  ----- */

int main()
{
    return 0;
}

pNode listCreate ( ElementType newelement )
{
    pNode list;
    list=(pNode)malloc(sizeof(Node));
    list->element=newelement;
    list->prior=list;
    list->next=list;
    return list;
}		/* -----  end of function listCreateList  ----- */

ListPos listInsert ( ListPos pos,ElementType newelement )
{
    pNode pTmpCell;
    pNode nextPos=pos->next;
    pTmpCell=(pNode)malloc(sizeof(Node));
    pTmpCell->element=newelement;
    pTmpCell->next=pos->next;
    pos->next=pTmpCell;
    pTmpCell->prior=pos;
    //printElement(nextPos->element);
    nextPos->prior=pTmpCell;
    pTmpCell->prior=pos;
    return pTmpCell;
}		/* -----  end of function listInsert  ----- */

int listDelete ( List list,ElementType delElement )
{
    ListPos prePos,delPos;
    delPos=listFind(list,delElement);
    prePos=delPos->prior;
    prePos->next=delPos->next;
    delPos->next->prior=prePos;
    free(delPos);
    return 0;
}		/* -----  end of function listDelete  ----- */

ListPos listFind ( List list,ElementType findElement )
{
    ListPos pos=list;
    ListPos end=list;
    do
    {
        if(!elementcmp(pos->element,findElement))
        {
            return pos;
            break;
        }
        else
        {
            pos=pos->next;
        }
    }while(pos!=end);
    return NULL;
}		/* -----  end of function listFind  ----- */
int listGetLen ( List list )
{
    int count=1;
    ListPos pos=list->next;
    while(pos!=list)
    {
        count++;
        pos=pos->next;
    }
    return count;
}		/* -----  end of function listGetLen  ----- */
int listWalkOrder ( List list,int (*walkWay)(ElementType ele) )
{
    ListPos pos=list;
    ListPos end=list;
    do
    {
        (*walkWay)(pos->element);
        pos=pos->next;
    }while(pos!=end);
    return 0;
}		/* -----  end of function listWalkOrder  ----- */
int listWalkReverse ( List list,int (*walkWay)(ElementType ele) )
{
    ListPos pos=list;
    ListPos end=list;
    do
    {
        pos=pos->prior;
        (*walkWay)(pos->element);
    }while(pos!=end);
    return 0;
}		/* -----  end of function listWalkReverse  ----- */
int listSwap ( pNode i,pNode j )
{
    ElementType temp;
    temp=i->element;
    i->element=j->element;
    j->element=temp;
    return 0;
}		/* -----  end of function listSwap  ----- */
List listSort ( List list )
{
    pNode p=list;
    pNode q=list;
    pNode end=list;
    do
    {
        q=p->next;
        do
        {
            if(elementcmp(p->element,q->element)<0)
            {
                listSwap(p,q);
            }
            q=q->next;
        }
        while(q!=end);
        p=p->next;
    }
    while(p!=end);
    return list;
}		/* -----  end of function listBubbleSort  ----- */


text:
package model

import (
	"fmt"
	"time"
)

type Commit struct {
	ID          int64     `meddler:"id,pk"            json:"id"`
	RepoID      int64     `meddler:"repo_id"          json:"-"`
	Status      string    `meddler:"status"           json:"status"`
	Started     time.Time `meddler:"started,utctime"  json:"started"`
	Finished    time.Time `meddler:"finished,utctime" json:"finished"`
	Duration    int64     `meddler:"duration"         json:"duration"`
	Hash        string    `meddler:"hash"             json:"hash"`
	Branch      string    `meddler:"branch"           json:"branch"`
	PullRequest string    `meddler:"pull_request"     json:"pull_request"`
	Author      string    `meddler:"author"           json:"author"`
	Gravatar    string    `meddler:"gravatar"         json:"gravatar"`
	Timestamp   string    `meddler:"timestamp"        json:"timestamp"`
	Message     string    `meddler:"message"          json:"message"`

	Created time.Time `meddler:"created,utctime"  json:"created"`
	Updated time.Time `meddler:"updated,utctime"  json:"updated"`
}

// Returns the Short (--short) Commit Hash.
func (c *Commit) HashShort() string {
	if len(c.Hash) > 6 {
		return c.Hash[:6]
	} else {
		return c.Hash
	}
}

// Returns the Gravatar Image URL.
func (c *Commit) Image() string      { return fmt.Sprintf(GravatarPattern, c.Gravatar, 42) }
func (c *Commit) ImageSmall() string { return fmt.Sprintf(GravatarPattern, c.Gravatar, 32) }
func (c *Commit) ImageLarge() string { return fmt.Sprintf(GravatarPattern, c.Gravatar, 160) }

// Returns the Started Date as an ISO8601
// formatted string.
func (c *Commit) StartedString() string {
	return c.Started.Format("2006-01-02T15:04:05Z")
}

// Returns the Created Date as an ISO8601
// formatted string.
func (c *Commit) CreatedString() string {
	return c.Created.Format("2006-01-02T15:04:05Z")
}

// Returns the Started Date as an ISO8601
// formatted string.
func (c *Commit) FinishedString() string {
	return c.Finished.Format("2006-01-02T15:04:05Z")
}

// Set the Author's email address and calculate the
// Gravatar hash.
func (c *Commit) SetAuthor(email string) {
	c.Author = email
	c.Gravatar = createGravatar(email)
}

// Combined Repository and Commit details
type RepoCommit struct {
	// Repo Details
	Slug  string `meddler:"slug"  json:"slug"`
	Host  string `meddler:"host"  json:"host"`
	Owner string `meddler:"owner" json:"owner"`
	Name  string `meddler:"name"  json:"name"`

	// Commit Details
	Status      string    `meddler:"status"           json:"status"`
	Started     time.Time `meddler:"started,utctime"  json:"started"`
	Finished    time.Time `meddler:"finished,utctime" json:"finished"`
	Duration    int64     `meddler:"duration"         json:"duration"`
	Hash        string    `meddler:"hash"             json:"hash"`
	Branch      string    `meddler:"branch"           json:"branch"`
	PullRequest string    `meddler:"pull_request"     json:"pull_request"`
	Author      string    `meddler:"author"           json:"author"`
	Gravatar    string    `meddler:"gravatar"         json:"gravatar"`
	Timestamp   string    `meddler:"timestamp"        json:"timestamp"`
	Message     string    `meddler:"message"          json:"message"`
	Created     time.Time `meddler:"created,utctime"  json:"created"`
	Updated     time.Time `meddler:"updated,utctime"  json:"updated"`
}

// Returns the Short (--short) Commit Hash.
func (c *RepoCommit) HashShort() string {
	if len(c.Hash) > 6 {
		return c.Hash[:6]
	} else {
		return c.Hash
	}
}

// Returns the Gravatar Image URL.
func (c *RepoCommit) Image() string      { return fmt.Sprintf(GravatarPattern, c.Gravatar, 42) }
func (c *RepoCommit) ImageSmall() string { return fmt.Sprintf(GravatarPattern, c.Gravatar, 32) }
func (c *RepoCommit) ImageLarge() string { return fmt.Sprintf(GravatarPattern, c.Gravatar, 160) }

// Returns the Started Date as an ISO8601
// formatted string.
func (c *RepoCommit) StartedString() string {
	return c.Started.Format("2006-01-02T15:04:05Z")
}

// Returns the Created Date as an ISO8601
// formatted string.
func (c *RepoCommit) CreatedString() string {
	return c.Created.Format("2006-01-02T15:04:05Z")
}

// Returns the Started Date as an ISO8601
// formatted string.
func (c *RepoCommit) FinishedString() string {
	return c.Finished.Format("2006-01-02T15:04:05Z")
}


text:
start /b phantomjs --webdriver=8001 --webdriver-loglevel=DEBUG > log/webdriver.log

php ..\dist\vendor\phpunit\phpunit\phpunit --bootstrap bootstrap.php -c configuration.xml

Taskkill /IM phantomjs.exe /F


text:
--------------------------------
--
-- @function [parent=#BezierBy] clone
-- @param self
-- @return BezierBy#BezierBy ret (return value: cc.BezierBy)

--------------------------------
--
-- @function [parent=#BezierBy] reverse
-- @param self
-- @return BezierBy#BezierBy ret (return value: cc.BezierBy)

--------------------------------
-- param time in seconds
-- @function [parent=#BezierBy] update
-- @param self
-- @param #float time
-- @return BezierBy#BezierBy self (return value: cc.BezierBy)

return nil


text:
from __future__ import division
import libtbx.load_env

def run():
  print abs(libtbx.env.lib_path)

if (__name__ == "__main__"):
  run()


text:
NSString *baseURLUserDefaultKey = @"photobox.base.url";
NSString *consumerTokenIdentifier = @"photobox.consumer.token";
NSString *oauthTokenIdentifier = @"photobox.oauth.token";
NSString *PhotoBoxAccessTokenDidAcquiredNotification = @"com.photobox.accessTokenDidAcquired";

#define IS_USER_LOGGING_IN_KEY @"IS_USER_LOGGING_IN_KEY"

@implementation ConnectionManager

+ (ConnectionManager *)sharedManager {
    static ConnectionManager *_sharedManager = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _sharedManager = [[ConnectionManager alloc] init];
    });

    return _sharedManager;
}

- (id)init {
    self = [super init];
    if (self) {
        [self setup];

        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(accessTokenDidFetchNotification:) name:PhotoBoxAccessTokenDidAcquiredNotification object:nil];
    }

    return self;
}

- (void)setup {
    AFOAuth1Token *consumerToken = [AFOAuth1Token retrieveCredentialWithIdentifier:consumerTokenIdentifier];
    if (consumerToken) {
        self.consumerToken = consumerToken;
        [[APIClient sharedClient] setConsumerToken:consumerToken];
    } else {
        self.consumerToken = nil;
    }
    AFOAuth1Token *oauthToken = [AFOAuth1Token retrieveCredentialWithIdentifier:oauthTokenIdentifier];
    if (oauthToken) {
        self.oauthToken = oauthToken;
        [[APIClient sharedClient] setAccessToken:oauthToken];
    } else {
        self.oauthToken = nil;
    }
    NSURL *baseURL = [NSURL URLWithString:[[NSUserDefaults standardUserDefaults] objectForKey:baseURLUserDefaultKey]];
    if (baseURL) {
        self.baseURL = baseURL;
    } else {
        self.baseURL = [NSURL URLWithString:@"http://trovebox.com"];
        [self deleteTokens];
        self.consumerToken = [[AFOAuth1Token alloc] initWithKey:@"whatever" secret:@"whatever" session:nil expiration:nil renewable:YES];

    }

}

- (void)connectAsGuest:(NSURL *)url {
    self.isGuestUser = YES;
    [self setBaseURL:url];
    _consumerToken = [[AFOAuth1Token alloc] initWithKey:@"c74a0c32f07dd015328d19d7d8cddc" secret:@"eb6d7e5bbb" session:nil expiration:nil renewable:YES];
    [AFOAuth1Token storeCredential:_consumerToken withIdentifier:consumerTokenIdentifier];
    _oauthToken = [[AFOAuth1Token alloc] initWithKey:@"7fefb2ccfd7c059985c7bad3ccf6e6" secret:@"978a2788c8" session:nil expiration:nil renewable:YES];
    [AFOAuth1Token storeCredential:_oauthToken withIdentifier:oauthTokenIdentifier];

    [[APIClient sharedClient] refreshConnectionParameters];

    [self willChangeValueForKey:NSStringFromSelector(@selector(isUserLoggedIn))];
    _userLoggedIn = _oauthToken?YES:NO;
    [self didChangeValueForKey:NSStringFromSelector(@selector(isUserLoggedIn))];

    [self accessTokenDidFetchNotification:nil];
}

- (void)setBaseURL:(NSURL *)baseURL consumerKey:(NSString *)consumerKey consumerSecret:(NSString *)consumerSecret oauthToken:(NSString *)oauthToken oauthSecret:(NSString *)oauthSecret {
    self.baseURL = baseURL;
    if (consumerKey && consumerSecret) {
        self.consumerToken = [[AFOAuth1Token alloc] initWithKey:consumerKey secret:consumerSecret session:nil expiration:nil renewable:YES];
    }
    if (oauthToken && oauthSecret) {
        self.oauthToken = [[AFOAuth1Token alloc] initWithKey:oauthToken secret:oauthSecret session:nil expiration:nil renewable:YES];
    }
}

- (void)setBaseURL:(NSURL *)baseURL {
    if (_baseURL != baseURL) {
        _baseURL = baseURL;
        [[NSUserDefaults standardUserDefaults] setObject:_baseURL.absoluteString forKey:baseURLUserDefaultKey];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }
}

- (void)setConsumerToken:(AFOAuth1Token *)consumerToken {
    if (_consumerToken != consumerToken) {
        _consumerToken = consumerToken;
        if (_consumerToken) {
            [AFOAuth1Token storeCredential:_consumerToken withIdentifier:consumerTokenIdentifier];
        }
    }
}

- (void)setOauthToken:(AFOAuth1Token *)oauthToken {
    if (_oauthToken != oauthToken) {
        _oauthToken = oauthToken;
        if (_oauthToken) {
            [AFOAuth1Token storeCredential:_oauthToken withIdentifier:oauthTokenIdentifier];
        }
        [self willChangeValueForKey:NSStringFromSelector(@selector(isUserLoggedIn))];
        _userLoggedIn = _oauthToken?YES:NO;
        [self didChangeValueForKey:NSStringFromSelector(@selector(isUserLoggedIn))];

        if (_userLoggedIn) {
            [[NSUserDefaults standardUserDefaults] setBool:NO forKey:IS_USER_LOGGING_IN_KEY];
            [[NSUserDefaults standardUserDefaults] synchronize];
        }
    }
}

- (void)removeConsumerTokenWithIdentifier:(NSString *)identifier {
    [self removeCredentialWithIdentifier:identifier];
}

- (void)removeOauthTokenWithIdentifier:(NSString *)identifier {
    [self removeCredentialWithIdentifier:identifier];
}

- (void)removeCredentialWithIdentifier:(NSString *)identifier {
    [AFOAuth1Token deleteCredentialWithIdentifier:identifier];
}

- (void)deleteTokens {
    self.oauthToken = nil;
    self.consumerToken = nil;
    [self removeOauthTokenWithIdentifier:oauthTokenIdentifier];
    [self removeConsumerTokenWithIdentifier:consumerTokenIdentifier];
}

- (void)logout {
    [self logoutWithShowingLoginScreen:YES];
}

- (void)logoutWithShowingLoginScreen:(BOOL)show {
    [self deleteTokens];
    self.isGuestUser = NO;
    [[DownloadedImageManager sharedManager] clearHistory];
    [[FavoritesManager sharedManager] clearHistory];
    self.baseURL = nil;

    [[TMCache sharedCache] removeAllObjects:nil];
    NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];
    [[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain];

    [self setup];

    [[APIClient sharedClient] setAccessToken:nil];

    if (show) {
        [self openLoginFromStoryboardWithIdentifier:@"loginViewController"];
    }
}

- (BOOL)isUserLoggingIn {
    return [[NSUserDefaults standardUserDefaults] boolForKey:IS_USER_LOGGING_IN_KEY];
}

- (NSURL *)startOAuthAuthorizationWithServerURL:(NSString *)serverStringURL {
    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:IS_USER_LOGGING_IN_KEY];
    [[NSUserDefaults standardUserDefaults] synchronize];

    [self setBaseURL:[NSURL URLWithString:serverStringURL]];
   // NSAssert([[[[APIClient sharedClient] baseURL] absoluteString] isEqualToString:self.baseURL.absoluteString], @"Expected base url: %@. Actual: %@", self.baseURL.absoluteString, [[[APIClient sharedClient] baseURL] absoluteString]);
    //[[UIApplication sharedApplication] openURL:[[self class] oAuthInitialUrlForServer:serverStringURL]];

    return [[self class] oAuthInitialUrlForServer:serverStringURL];
}

- (void)continueOauthAuthorizationWithQuery:(NSString *)query {
    // sample: oauth_consumer_key=c12db8b814d71cf56d1e187ecec048&oauth_consumer_secret=371a5a63fa&oauth_token=a5322075c486ea210c075ae3546403&oauth_token_secret=1f47d2e62e&oauth_verifier=aaa32b81ae
    NSString *consumerKey, *consumerSecret;
    NSArray *queryElements = [query componentsSeparatedByString:@"&"];
    for (NSString *element in queryElements) {
        NSArray *keyVal = [element componentsSeparatedByString:@"="];
        NSString *variableKey = [keyVal objectAtIndex:0];
        NSString *value = [keyVal lastObject];

        // get all details from the request and save it
        if ([variableKey isEqualToString:@"oauth_consumer_key"]){
            consumerKey = value;
        }else if ([variableKey isEqualToString:@"oauth_consumer_secret"]){
            consumerSecret = value;
        }
    }
    AFOAuth1Token *consumerToken = [[AFOAuth1Token alloc] initWithKey:consumerKey secret:consumerSecret session:nil expiration:nil renewable:YES];
    self.consumerToken = consumerToken;
    [[APIClient sharedClient] setConsumerToken:consumerToken];

    AFOAuth1Token *requestToken = [[AFOAuth1Token alloc] initWithQueryString:query];
    NSString *verifier = [requestToken.userInfo objectForKey:@"oauth_verifier"];
    [requestToken setVerifier:verifier];

    [[APIClient sharedClient] acquireOAuthAccessTokenWithPath:@"/v1/oauth/token/access"
                                                 requestToken:requestToken
                                                 accessMethod:@"POST"
                                                      success:^(AFOAuth1Token *accessToken, id responseObject) {
        self.oauthToken = accessToken;
        [[APIClient sharedClient] setAccessToken:accessToken];

        [[NSNotificationCenter defaultCenter] postNotificationName:PhotoBoxAccessTokenDidAcquiredNotification object:nil];
    } failure:^(NSError *error) {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Authorization Failure", nil) message:error.localizedDescription delegate:nil cancelButtonTitle:NSLocalizedString(@"Dismiss", nil) otherButtonTitles: nil];
        [alert show];
    }];
}

- (void)openLoginFromStoryboardWithIdentifier:(NSString *)storyboardId {
    if (!self.isShowingLoginPage) {
        [self willChangeValueForKey:@"isShowingLoginPage"];
        self.isShowingLoginPage = YES;
        [self didChangeValueForKey:@"isShowingLoginPage"];
        UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        UIViewController *viewController = [mainStoryboard instantiateViewControllerWithIdentifier:storyboardId];
        UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
        [window.rootViewController presentViewController:viewController animated:YES completion:nil];
    }
}

- (void)accessTokenDidFetchNotification:(NSNotification *)notification {
    [self willChangeValueForKey:@"isShowingLoginPage"];
    self.isShowingLoginPage = NO;
    [self didChangeValueForKey:@"isShowingLoginPage"];
    UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
    [window.rootViewController dismissViewControllerAnimated:YES completion:^{
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
    }];
}

+ (NSURL *)oAuthInitialUrlForServer:(NSString *)server {
    NSString *callback = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleURLTypes"][0][@"CFBundleURLSchemes"][0];
    NSString *path = [NSString stringWithFormat:@"/v1/oauth/authorize?oauth_callback=%@://&name=", callback];
    NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
    NSString *fullPath = [[NSString alloc]initWithFormat:@"%@%@%@",server,path,[appName stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] ;

    NSURL *url = [NSURL URLWithString:fullPath];
    return url;
}

+ (NSURL *)oAuthAccessUrlForServer:(NSString *)server {
    NSString* url = [[NSString alloc]initWithFormat:@"%@%@",server,@"/v1/oauth/token/access"];
    return [NSURL URLWithString:url];
}

@end


text:
namespace DecoratorVehicleDemo.Decorators
{
    using System;

    using DecoratorVehicleDemo.Component;

    internal class LeatherInteriorDecorator : VehicleDecorator
    {
        private const decimal LeatherInteriorPrice = 7500;

        public LeatherInteriorDecorator(VehicleComponent vehicle)
            : base(vehicle)
        {
            this.Vehicle.UpdatePrice(LeatherInteriorPrice);
        }

        public override void DisplayInfo()
        {
            base.DisplayInfo();
            Console.WriteLine("++ Leather Interior Included");
        }
    }
}


text:
<?php

namespace Xero;

class XeroException extends \Exception
{

}


text:
import {Unit, JSONFormat, CartoCSS, CommonUtil} from '@supermap/iclient-common';
import {StyleUtils} from '../../core/StyleUtils';
import {Util} from '../../core/Util';
import Observable from 'ol/Observable';
import Style from 'ol/style/Style';
import CircleStyle from 'ol/style/Circle';
import FillStyle from 'ol/style/Fill';
import StrokeStyle from 'ol/style/Stroke';
import Text from 'ol/style/Text';
/**
 * @class ol.supermap.VectorTileStyles
 * @classdesc 矢量瓦片风格。
 * @category  Visualization VectorTile
 * @param {Object} options - 交互时所需可选参数。
 * @extends {ol/Observable}
 */
export class VectorTileStyles extends Observable {

    constructor(options) {
        super();
        if (!options) {
            return;
        }
        var donotNeedServerCartoCss = false;
        if (options.donotNeedServerCartoCss !== undefined) {
            donotNeedServerCartoCss = options.donotNeedServerCartoCss
        }
        VectorTileStyles.setDonotNeedServerCartoCss(donotNeedServerCartoCss);
        if (options.view) {
            VectorTileStyles.setView(options.view);
        }
        if (options.url) {
            VectorTileStyles.setUrl(options.url);
        }
        if (options.cartoCss) {
            VectorTileStyles.setCartoCss(options.cartoCss);
        }
        var selectedPointStyle = getDefaultSelectedPointStyle();
        if (options.selectedPointStyle) {
            selectedPointStyle = options.selectedPointStyle;
        }
        VectorTileStyles.setSelectedPointStyle(selectedPointStyle);
        var selectedLineStyle = getDefaultSelectedLineStyle();
        if (options.selectedLineStyle) {
            selectedLineStyle = options.selectedLineStyle;
        }
        VectorTileStyles.setSelectedLineStyle(selectedLineStyle);
        var selectedRegionStyle = getDefaultSelectedRegionStyle();
        if (options.selectedRegionStyle) {
            selectedRegionStyle = options.selectedRegionStyle;
        }
        VectorTileStyles.setSelectedRegionStyle(selectedRegionStyle);
        var selectedTextStyle = getDefaultSelectedTextStyle();
        if (options.selectedTextStyle) {
            selectedTextStyle = options.selectedTextStyle;
        }
        VectorTileStyles.setSelectedTextStyle(selectedTextStyle);
        var layersXHR = new XMLHttpRequest();
        layersXHR.onreadystatechange = function () {
            if (layersXHR.readyState == 4) {
                var result = JSON.parse(layersXHR.responseText);
                var layersInfo = {};
                for (var i = 0, len = result.length; i < len; i++) {
                    var layers = result[i].subLayers.layers;
                    for (var j = 0, len1 = layers.length; j < len1; j++) {
                        layers[j].layerIndex = len1 - j;
                        layersInfo[layers[j].name] = layers[j];
                    }
                }
                VectorTileStyles.setLayersInfo(layersInfo);
                if (!VectorTileStyles.getDonotNeedServerCartoCss()) {
                    var vectorStylesXHR = new XMLHttpRequest();
                    vectorStylesXHR.open("GET", CommonUtil.urlPathAppend(VectorTileStyles.getUrl(), "tileFeature/vectorstyles.json"), false);
                    vectorStylesXHR.onreadystatechange = function () {
                        if (vectorStylesXHR.readyState == 4) {
                            var vectorStyles = new JSONFormat().read(vectorStylesXHR.responseText);
                            var cartoCss;
                            if (vectorStyles.style && vectorStyles.type === 'cartoCSS') {
                                cartoCss = vectorStyles.style;
                                cartoCss = cartoCss.replace(/[@]/gi, "___");
                                cartoCss = cartoCss.replace(/\\#/gi, "___");
                                //替换一些关键符号
                                var cachedLayer = {};
                                layersInfo && Object.keys(layersInfo).sort().forEach(function (attr) {
                                    var newAttr = attr.replace(/[@#\s]/gi, "___");
                                    var to = attr;
                                    var keys = Object.keys(cachedLayer);
                                    for (let index = keys.length; index > -1; index--) {
                                        if (attr.indexOf(keys[index]) > -1) {
                                            to = attr.replace(keys[index], cachedLayer[keys[index]]);
                                            break;
                                        }
                                    }
                                    to = to.replace(/[#]/gi, "\#");
                                    cachedLayer[attr] = newAttr;
                                    cartoCss = cartoCss.replace(new RegExp(to, "g"), newAttr);
                                })
                                cartoCss = cartoCss.replace(/[#]/gi, "\n#");
                                //将zoom转化为scale,以免引起混淆
                                cartoCss = cartoCss.replace(/\[zoom/gi, "[scale");
                            }
                            var cartoShadersArray = new CartoCSS(cartoCss).getShaders();
                            var cartoShaders = {};
                            cartoShadersArray.map(function (cartoShader) {
                                cartoShaders[cartoShader.elements[0].clean] = cartoShaders[cartoShader.elements[0].clean] || {};
                                cartoShaders[cartoShader.elements[0].clean][cartoShader.attachment] = cartoShaders[cartoShader.elements[0].clean][cartoShader.attachment] || [];
                                cartoShaders[cartoShader.elements[0].clean][cartoShader.attachment].push(cartoShader);
                                return cartoShader;
                            });
                            VectorTileStyles.setCartoShaders(cartoShaders);
                        }
                    };
                    vectorStylesXHR.send(null);
                }
                if (VectorTileStyles.getCartoCss()) {
                    var clientCartoShadersArray = new CartoCSS(VectorTileStyles.getCartoCss()).getShaders();
                    var clientCartoShaders = {};
                    clientCartoShadersArray.map(function (cartoShader) {
                        clientCartoShaders[cartoShader.elements[0].clean] = clientCartoShaders[cartoShader.elements[0].clean] || {};
                        clientCartoShaders[cartoShader.elements[0].clean][cartoShader.attachment] = clientCartoShaders[cartoShader.elements[0].clean][cartoShader.attachment] || [];
                        clientCartoShaders[cartoShader.elements[0].clean][cartoShader.attachment].push(cartoShader);
                        return cartoShader;
                    });
                    VectorTileStyles.setClientCartoShaders(clientCartoShaders);
                }
            }
        };
        layersXHR.open("GET", CommonUtil.urlPathAppend(VectorTileStyles.getUrl(), "layers.json"), false);
        layersXHR.send(null);
        this.on('featureSelected', function (e) {
            VectorTileStyles.setSelectedId(e.selectedId);
            VectorTileStyles.setLayerName(e.layerName);
        });

        /**
         * @function VectorTileStyles.prototype.getDefaultSelectedPointStyle
         * @description 设置默认选择后的点样式。
         */
        function getDefaultSelectedPointStyle() {
            return new Style({
                image: new CircleStyle({
                    radius: 5,
                    fill: new FillStyle({
                        color: 'blue'
                    })
                })
            })
        }

        /**
         * @function VectorTileStyles.prototype.getDefaultSelectedLineStyle
         * @description 设置默认选择后的线样式。
         */
        function getDefaultSelectedLineStyle() {
            return new Style({
                stroke: new StrokeStyle({
                    color: 'blue',
                    width: 3
                })
            })
        }

        /**
         * @function VectorTileStyles.prototype.getDefaultSelectedRegionStyle
         * @description 设置默认选择后的面样式。
         */
        function getDefaultSelectedRegionStyle() {
            return new Style({
                fill: new FillStyle({
                    color: [0, 0, 255, 0.5]
                }),
                stroke: new StrokeStyle({
                    color: 'blue',
                    width: 3
                })
            })
        }

        /**
         * @function VectorTileStyles.prototype.getDefaultSelectedTextStyle
         * @description 设置默认选择后的文本样式。
         */
        function getDefaultSelectedTextStyle() {
            return new Style({
                text: new Text({
                    font: '15px Microsoft YaHei',
                    fill: new FillStyle({
                        color: 'blue'
                    }),
                    stroke: new StrokeStyle({
                        color: 'white',
                        width: 1
                    })
                })
            });
        }
    }

    /**
     * @function ol.supermap.VectorTileStyles.setCartoShaders
     * @description 设置 Carto 的阴影。
     * @param {Array} cartoShaders - Carto 阴影。
     */
    static setCartoShaders(cartoShaders) {
        this.cartoShaders = cartoShaders;
    }

    /**
     * @function ol.supermap.VectorTileStyles.getCartoShaders
     * @description 获取客户端 Carto 的阴影。
     */
    static getCartoShaders() {
        return this.cartoShaders;
    }

    /**
     * @function ol.supermap.VectorTileStyles.setClientCartoShaders
     * @description 设置客户端 Carto 的阴影。
     * @param {Array} clientCartoShaders - 客户端 Carto 阴影。
     */
    static setClientCartoShaders(clientCartoShaders) {
        this.clientCartoShaders = clientCartoShaders;
    }

    /**
     * @function ol.supermap.VectorTileStyles.getClientCartoShaders
     * @description 获取客户端 Carto 的阴影。
     */
    static getClientCartoShaders() {
        return this.clientCartoShaders;
    }

    /**
     * @function VectorTileStyles.setCartoCss
     * @description 设置 cartoCss 的样式。
     * @param {Object} cartoCss - cartoCss 的样式。
     */
    static setCartoCss(cartoCss) {
        this.cartoCss = cartoCss;
    }

    /**
     * @function ol.supermap.VectorTileStyles.getCartoCss
     * @description 获取 cartoCss 的样式。
     */
    static getCartoCss() {
        return this.cartoCss;
    }

    /**
     * @function ol.supermap.VectorTileStyles.setDonotNeedServerCartoCss
     * @description 设置是否需要 CartoCss 服务。
     * @param {Object} donotNeedServerCartoCss - 是否需要 CartoCss 服务。
     */
    static setDonotNeedServerCartoCss(donotNeedServerCartoCss) {
        this.donotNeedServerCartoCss = donotNeedServerCartoCss;
    }

    /**
     * @function ol.supermap.VectorTileStyles.getDonotNeedServerCartoCss
     * @description 获取是否需要 CartoCss 服务。
     */
    static getDonotNeedServerCartoCss() {
        return this.donotNeedServerCartoCss;
    }

    /**
     * @function ol.supermap.VectorTileStyles.setLayersInfo
     * @description 设置图层信息服务。
     * @param {Object} layersInfo - 图层信息。
     */
    static setLayersInfo(layersInfo) {
        this.layersInfo = layersInfo;
    }

    /**
     * @function ol.supermap.VectorTileStyles.getLayersInfo
     * @description 获取图层信息服务。
     */
    static getLayersInfo() {
        return this.layersInfo;
    }

    /**
     * @function ol.supermap.VectorTileStyles.setUrl
     * @description 设置地址。
     * @param {string} url - 地址。
     */
    static setUrl(url) {
        this.url = url;
    }

    /**
     * @function ol.supermap.VectorTileStyles.getUrl
     * @description 获取地址。
     */
    static getUrl() {
        return this.url;
    }

    /**
     * @function ol.supermap.VectorTileStyles.setView
     * @description 设置视图。
     * @param {Object} view - 视图。
     */
    static setView(view) {
        this.view = view;
    }

    /**
     * @function ol.supermap.VectorTileStyles.getView
     * @description 获取视图。
     */
    static getView() {
        return this.view;
    }

    /**
     * @function ol.supermap.VectorTileStyles.setSelectedId
     * @description 设置选择序号。
     * @param {number} selectedId - 选择序号。
     */
    static setSelectedId(selectedId) {
        this.selectedId = selectedId;
    }

    /**
     * @function ol.supermap.VectorTileStyles.getSelectedId
     * @description 获取选择序号。
     */
    static getSelectedId() {
        return this.selectedId;
    }

    /**
     * @function ol.supermap.VectorTileStyles.setLayerName
     * @description 设置图层名称。
     * @param {string} layerName - 图层名称。
     */
    static setLayerName(layerName) {
        this.layerName = layerName;
    }

    /**
     * @function ol.supermap.VectorTileStyles.getLayerName
     * @description 获取图层名称。
     */
    static getLayerName() {
        return this.layerName;
    }

    /**
     * @function ol.supermap.VectorTileStyles.setSelectedPointStyle
     * @description 设置选择后点样式。
     * @param {Object} selectedPointStyle - 选择后点样式。
     */
    static setSelectedPointStyle(selectedPointStyle) {
        this.selectedPointStyle = selectedPointStyle;
    }

    /**
     * @function ol.supermap.VectorTileStyles.setSelectedLineStyle
     * @description 设置选择后线样式。
     * @param {Object} selectedLineStyle - 选择后线样式。
     */
    static setSelectedLineStyle(selectedLineStyle) {
        this.selectedLineStyle = selectedLineStyle;
    }

    /**
     * @function ol.supermap.VectorTileStyles.setSelectedRegionStyle
     * @description 设置选择后面样式。
     * @param {Object} selectedRegionStyle - 选择后面样式。
     */
    static setSelectedRegionStyle(selectedRegionStyle) {
        this.selectedRegionStyle = selectedRegionStyle;
    }

    /**
     * @function ol.supermap.VectorTileStyles.setSelectedRegionStyle
     * @description 设置选择后文本样式。
     * @param {Object} selectedTextStyle - 选择后文本样式。
     */
    static setSelectedTextStyle(selectedTextStyle) {
        this.selectedTextStyle = selectedTextStyle;
    }

    /**
     * @function ol.supermap.VectorTileStyles.getSelectedStyle
     * @description 设置选择后的样式。
     * @param {string} type - 选择后的样式。
     */
    static getSelectedStyle(type) {
        if (type === 'POINT' || type === 'MULTIPOINT') {
            return this.selectedPointStyle;
        }
        if (type === 'LINESTRING' || type === 'MULTILINESTRING') {
            return this.selectedLineStyle;
        }
        if (type === 'POLYGON' || type === 'MULTIPOLYGON') {
            return this.selectedRegionStyle;
        }
        if (type === 'TEXT') {
            return this.selectedTextStyle;
        }
    }

    /**
     * @function ol.supermap.VectorTileStyles.getLayerInfo
     * @description 获取图层的信息。
     * @param {string} layerName - 图层名。
     */
    static getLayerInfo(layerName) {
        var layersInfo = VectorTileStyles.getLayersInfo();
        if (layersInfo === undefined) {
            return null;
        }
        var layerInfo = layersInfo[layerName];
        if (!layerInfo) {
            return null;
        }
        var layerInfo_simple = {layerIndex: layerInfo.layerIndex, ugcLayerType: layerInfo.ugcLayerType};
        switch (layerInfo.ugcLayerType) {
            case "VECTOR":
                layerInfo_simple.layerStyle = layerInfo.style ? layerInfo.style : null;
                break;
            case "THEME":
                var theme = layerInfo.theme;
                layerInfo_simple.layerStyle = theme ? theme.defaultStyle : null;
                if (theme && theme.type === "LABEL") {
                    layerInfo_simple.type = theme.type;
                    layerInfo_simple.textField = theme.labelExpression;
                }
                break;
            default :
                //SVTile发布出来的地图没有ugcLayerType属性
                if (layerInfo.style) {
                    layerInfo_simple.layerStyle = layerInfo.style;
                }
                break;
        }
        return layerInfo_simple;
    }

    /**
     * @function ol.supermap.VectorTileStyles.getStyle
     * @description 获取样式。
     * @param {string} originalLayerName - 原始图层信息。
     * @param {Object} feature - 要素对象。
     */
    static getStyle(originalLayerName, feature) {
        var url = VectorTileStyles.getUrl(),
            view = VectorTileStyles.getView(),
            zoom = view.getZoom(),
            dpi = 96,
            scale = Util.resolutionToScale(view.getResolution(), dpi, Unit.METER),
            layerName = originalLayerName.replace(/(@)/gi, '___').replace(/(#)/gi, '___');
        // feature对象样式的配置遵循以下优先级:
        // 客户端CartoCSS > 服务器端CartoCSS > 服务器端layer样式 > 客户端默认样式。
        if (VectorTileStyles.getCartoCss() && VectorTileStyles.getClientCartoShaders()[layerName]) {
            return getStyleArray(VectorTileStyles.getClientCartoShaders()[layerName]);
        }
        var layerInfo = VectorTileStyles.getLayerInfo(originalLayerName);
        if (!VectorTileStyles.getDonotNeedServerCartoCss() && VectorTileStyles.getCartoShaders()[layerName]) {
            //如果是文本,这里特殊处理。
            if (feature.getProperties().textStyle || feature.getProperties().TEXT_FEATURE_CONTENT || layerInfo.type == 'LABEL' && layerInfo.textField) {
                var featureStyle = StyleUtils.getValidStyleFromLayerInfo(layerInfo, feature, url);
                if (feature.getGeometry().getType().toUpperCase() === "POINT") {
                    featureStyle = mergeTextFeatureStyle(layerInfo, feature, url);
                }
                return featureStyle;
            }
            return getStyleArray(VectorTileStyles.getCartoShaders()[layerName]);
        }
        if (layerInfo) {
            return StyleUtils.getValidStyleFromLayerInfo(layerInfo, feature, url);
        }

        function getStyleArray(shaderAttachment) {
            var styleArray = [];
            for (var j in shaderAttachment) {
                shaderAttachment[j].map(function (shader) {
                    styleArray.push(StyleUtils.getStyleFromCarto(zoom, scale, shader, feature, true, url))
                    return shader;
                })
            }
            return styleArray;
        }

        /**
         * @function ol.supermap.VectorTileStyles.prototype.mergeTextFeatureStyle
         * @description 合并文本要素样式。
         * @param {string} layerInfo - 图层信息。
         * @param {Object} feature - 获取的要素。
         * @param {string} url - 地址。
         */
        function mergeTextFeatureStyle(layerInfo, feature, url) {
            var textFeatureStyle = StyleUtils.getValidStyleFromLayerInfo(layerInfo, feature, url);
            if (layerInfo.type == 'LABEL') {
                feature.setProperties({type: "TEXT"});
                var cartoTextStyles = getStyleArray(VectorTileStyles.getCartoShaders()[layerName]);
                var textStyle = textFeatureStyle.getText();
                for (var i = 0; i < cartoTextStyles.length; i++) {
                    if (!textStyle) {
                        textStyle = cartoTextStyles[i].getText();
                    } else {
                        textStyle.setText(cartoTextStyles[i].getText().getText());
                    }
                }
                textFeatureStyle.setText(textStyle);
                return textFeatureStyle;
            }
            return textFeatureStyle;
        }

    }

    /**
     * @function ol.supermap.VectorTileStyles.prototype.getFeatureStyle
     * @description 获取要素样式。
     * @param {Object} feature - 要素。
     */
    getFeatureStyle(feature) {
        var selectedStyle;
        var layerName = feature.getProperties().layerName || feature.getProperties().layer;
        var id = feature.getProperties().id || parseInt(feature.getProperties().SmID);
        if (feature.getProperties().type && feature.getProperties().type.toUpperCase() === 'TEXT') {
            selectedStyle = VectorTileStyles.getSelectedStyle(feature.getProperties().type.toUpperCase());
            if (feature.getProperties().texts) {
                selectedStyle.getText().text_ = feature.getProperties().texts[0];
            } else {
                selectedStyle.getText().text_ = "";
            }
        } else {
            selectedStyle = VectorTileStyles.getSelectedStyle(feature.getGeometry().getType().toUpperCase());
        }
        if (selectedStyle) {
            var selectedLayerName = VectorTileStyles.getLayerName();
            var selectedId = VectorTileStyles.getSelectedId();
            if (selectedLayerName === layerName && id === selectedId) {
                return selectedStyle;
            }
        }
        return VectorTileStyles.getStyle(layerName, feature);
    }
}


text:
import { AssignmentUser } from './assignment-user';
import { Poll } from './poll';
import { AgendaBaseModel } from '../base/agenda-base-model';
import { SearchRepresentation } from '../../../core/services/search.service';

export const assignmentPhase = [
    { key: 0, name: 'Searching for candidates' },
    { key: 1, name: 'Voting' },
    { key: 2, name: 'Finished' }
];

/**
 * Representation of an assignment.
 * @ignore
 */
export class Assignment extends AgendaBaseModel {
    public id: number;
    public title: string;
    public description: string;
    public open_posts: number;
    public phase: number;
    public assignment_related_users: AssignmentUser[];
    public poll_description_default: number;
    public polls: Poll[];
    public agenda_item_id: number;
    public tags_id: number[];

    public constructor(input?: any) {
        super('assignments/assignment', 'Election', input);
    }

    public get candidateIds(): number[] {
        return this.assignment_related_users
            .sort((a: AssignmentUser, b: AssignmentUser) => {
                return a.weight - b.weight;
            })
            .map((candidate: AssignmentUser) => candidate.user_id);
    }

    public deserialize(input: any): void {
        Object.assign(this, input);

        this.assignment_related_users = [];
        if (input.assignment_related_users instanceof Array) {
            input.assignment_related_users.forEach(assignmentUserData => {
                this.assignment_related_users.push(new AssignmentUser(assignmentUserData));
            });
        }

        this.polls = [];
        if (input.polls instanceof Array) {
            input.polls.forEach(pollData => {
                this.polls.push(new Poll(pollData));
            });
        }
    }

    public getTitle(): string {
        return this.title;
    }

    public formatForSearch(): SearchRepresentation {
        return [this.title, this.description];
    }

    public getDetailStateURL(): string {
        return 'TODO';
    }
}


text:
package org.openforis.collect.relational;

import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.GregorianCalendar;

import org.junit.BeforeClass;
import org.openforis.collect.model.CollectRecord;
import org.openforis.collect.model.CollectRecord.Step;
import org.openforis.collect.model.CollectSurvey;
import org.openforis.collect.model.CollectSurveyContext;
import org.openforis.collect.persistence.xml.CollectSurveyIdmlBinder;
import org.openforis.idm.metamodel.xml.IdmlParseException;
import org.openforis.idm.model.Code;
import org.openforis.idm.model.Coordinate;
import org.openforis.idm.model.Date;
import org.openforis.idm.model.Entity;
import org.openforis.idm.model.EntityBuilder;
import org.openforis.idm.model.RealAttribute;
import org.openforis.idm.model.Time;
import org.openforis.idm.model.expression.ExpressionFactory;

/**
 *
 * @author G. Miceli
 *
 */
public class CollectRelationalTest {

	protected static CollectSurvey survey;

	@BeforeClass
	public static void loadSurvey() throws IdmlParseException,
			FileNotFoundException {
					InputStream is = ClassLoader.getSystemResourceAsStream("test.idm.xml");
			//		InputStream is = new FileInputStream("/home/gino/workspace/of/idm/idm-test/src/main/resources/test.idm.xml");
			//		InputStream is = new FileInputStream("D:/data/workspace/idm/idm-test/src/main/resources/test.idm.xml");
			//		InputStream is = new FileInputStream("/home/gino/workspace/faofin/tz/naforma-idm/tanzania-naforma.idm.xml");
					CollectSurveyContext ctx = new CollectSurveyContext(new ExpressionFactory(), null);
			//		DefaultSurveyContext ctx = new DefaultSurveyContext();
					CollectSurveyIdmlBinder binder = new CollectSurveyIdmlBinder(ctx);
					survey = (CollectSurvey) binder.unmarshal(is);
				}

	protected static CollectRecord createTestRecord(CollectSurvey survey, String id) {
		CollectRecord record = new CollectRecord(survey, "2.0");
		Entity cluster = record.createRootEntity("cluster");
		record.setCreationDate(new GregorianCalendar(2011, 12, 31, 23, 59).getTime());
		//record.setCreatedBy("ModelDaoIntegrationTest");
		record.setStep(Step.ENTRY);

		addTestValues(cluster, id);

		//set counts
		record.getEntityCounts().add(2);

		//set keys
		record.getRootEntityKeyValues().add(id);

		return record;
	}

	private static void addTestValues(Entity cluster, String id) {
	//		cluster.setId(100);
			EntityBuilder.addValue(cluster, "id", new Code(id));
			EntityBuilder.addValue(cluster, "gps_realtime", Boolean.TRUE);
			EntityBuilder.addValue(cluster, "region", new Code("001"));
			EntityBuilder.addValue(cluster, "district", new Code("002"));
			EntityBuilder.addValue(cluster, "crew_no", 10);
			EntityBuilder.addValue(cluster, "map_sheet", "value 1");
			EntityBuilder.addValue(cluster, "map_sheet", "value 2");
			EntityBuilder.addValue(cluster, "vehicle_location", new Coordinate((double)432423423l, (double)4324324l, "srs"));
			EntityBuilder.addValue(cluster, "gps_model", "TomTom 1.232");
			{
				Entity ts = EntityBuilder.addEntity(cluster, "time_study");
				EntityBuilder.addValue(ts, "date", new Date(2011,2,14));
				EntityBuilder.addValue(ts, "start_time", new Time(8,15));
				EntityBuilder.addValue(ts, "end_time", new Time(15,29));
			}
			{
				Entity ts = EntityBuilder.addEntity(cluster, "time_study");
				EntityBuilder.addValue(ts, "date", new Date(2011,2,15));
				EntityBuilder.addValue(ts, "start_time", new Time(8,32));
				EntityBuilder.addValue(ts, "end_time", new Time(11,20));
			}
			{
				Entity plot = EntityBuilder.addEntity(cluster, "plot");
				EntityBuilder.addValue(plot, "no", new Code("1"));
				Entity tree1 = EntityBuilder.addEntity(plot, "tree");
				EntityBuilder.addValue(tree1, "tree_no", 1);
				EntityBuilder.addValue(tree1, "dbh", 54.2);
				EntityBuilder.addValue(tree1, "total_height", 2.0);
	//			EntityBuilder.addValue(tree1, "bole_height", (Double) null).setMetadata(new CollectAttributeMetadata('*',null,"No value specified"));
				RealAttribute boleHeight = EntityBuilder.addValue(tree1, "bole_height", (Double) null);
				boleHeight.getField(0).setSymbol('*');
				boleHeight.getField(0).setRemarks("No value specified");
				Entity tree2 = EntityBuilder.addEntity(plot, "tree");
				EntityBuilder.addValue(tree2, "tree_no", 2);
				EntityBuilder.addValue(tree2, "dbh", 82.8);
				EntityBuilder.addValue(tree2, "total_height", 3.0);
			}
			{
				Entity plot = EntityBuilder.addEntity(cluster, "plot");
				EntityBuilder.addValue(plot, "no", new Code("2"));
				Entity tree1 = EntityBuilder.addEntity(plot, "tree");
				EntityBuilder.addValue(tree1, "tree_no", 1);
				EntityBuilder.addValue(tree1, "dbh", 34.2);
				EntityBuilder.addValue(tree1, "total_height", 2.0);
				Entity tree2 = EntityBuilder.addEntity(plot, "tree");
				EntityBuilder.addValue(tree2, "tree_no", 2);
				EntityBuilder.addValue(tree2, "dbh", 85.8);
				EntityBuilder.addValue(tree2, "total_height", 4.0);
			}
		}

	public CollectRelationalTest() {
		super();
	}

}


text:
title: "59 - db_info"
menu:
  main:
    name: "db_info"
    identifier: "technical/api/db_info"
    parent: "technical/api"
---
# Get information about objects to be created
    POST /api/v1/db_info/create?token=<token>

Retrieves information about what kind of objects is the session user allowed to create.

Usually, this call is executed twice:

1. without parameters, to obtain the list of allowed objecttypes and pools
2. with an objecttype (and a pool), to obtain the available tags and masks

## Query String

|   |   |
|---|---|
| `token` | Session token acquired with [/api/v1/session](/en/technical/api/session) |

## Input

A JSON object with the following attributes

|   |   |
|---|---|
| `objecttype` | Object type of the object (string, optional) |
| `pool_id`    | Pool ID the new object will be in (integer, optional), this is ignored if the `objecttype` was not provided |
| `tag_ids`    | Tag IDs for the new object (array of integers, optional, nullable), this is ignored if the `objecttype` was not provided |

If `tag_ids` is not given and the objecttype supports tags, the server will use the default tags. In this case, if the objecttype has a pool link
the `pool_id` is required. Otherwise, no tags will be used.

If `tag_ids` is set to **null**, tag filters will be ignored.

## Output

The output format is described below. The following rules apply:

- If the user did not provide an `objecttype`, the output contains the `_available_objecttypes`
- If the user provided an `objecttype` with pool link, but did not provide a pool:
    - if there is not pool/mask combination available, the call will return an error (***)
    - if there are available combinations, the call will return the `_available_objecttypes`, filtered by `objecttype` and available pools
- If the user provided an `objecttype` without pool, or an `objecttype` / `pool_id` combination:
    - if the objecttype lacks the `create` right, the call returns an empty `_available_objecttypes`
    - if there are no masks available, the call will return a NoMasksForCreateError
    - else, the call will return the `_available_objecttypes`, `_available_tags` and `_available_masks`

If the `tag_ids` parameter is provided, the tag filters will be checked against the given tags. If no `tag_ids` are provided, the tag filters will be ignored.
If the creation is not allowed for the given combination, an error is returned.

The output is a JSON object:

| Parameter | Description |
|---|---|
| `_available_objecttypes` | Available objecttypes for which the user has a "create" right (list), optionally filtered (see above) |
| ↦ `_id`            | Objecttype ID (integer) |
| ↦ `name`           | Objecttype name (string) |
| ↦ `pool_ids`       | Pool IDs for which the user has a "create" right (list of integers) |
| `_available_tags`        | Available tags |
| ↦ `_id`            | Tag ID (integer) |
| ↦ `_is_default`    | Tag is default (boolean) |
| `_available_masks`       | Available masks |
| ↦ `_id`            | Mask ID (integer): the mask "\_all\_fields" has no ID |
| ↦ `name`           | Mask name (string) |

The `_available_masks` are sorted by preference, according to the rules stated in [mask management](/en/technical/maskmanagement).

## Permissions

The user has to be authenticated.

## HTTP status codes

|   |   |
|---|---|
| 200 | Success |
| 400 | [API error](/en/technical/errors): something is malformed |
| 400 | [Not Authenticated](/en/technical/errors): session is not authenticated |
| 400 | [No Masks For Create](/en/technical/errors): no masks available |
| 500 | [Server error](/en/technical/errors): internal server error |

# Get information about objects to be updated
    POST /api/v1/db_info/update?token=<token>

Retrieves information about permissions, available masks and available tags for existing objects.

## Query String

|   |   |
|---|---|
| `token` | Session token acquired with [/api/v1/session](/en/technical/api/session) |

## Input

A JSON object with the following attributes

|   |   |
|---|---|
| `objecttype` | Object type of the object (string) |
| `object_ids` | Object IDs of existing objects (array of integers) |
| `pool_id`    | New pool for the objects (integer, optional) |
| `tag_ids`    | Tag IDs for the new objects (array of integers, optional) |

## Output

The output is a JSON object with the following attributes:

|   |   |
|---|---|
| `_generated_rights` | Effective rights for the objects (map) |
| `_available_pools`  | Pools the user is allowed to link the objects to (list of integers) |
| `_available_tags`   | Available tags for the objects (array of [tag entries](/en/technical/types/tag_entry)): only provided if "write" is in `_generated_rights` |
| `_available_masks`  | Available masks for the objects (array of entries: see below): only provided if "write" is in `_generated_rights` |

All fields are calculated as the intersection of the values for each object. That means that if only one object in the list
does not have the "unlink" right, it will not appear in the list, for instance. Conversely, every right that appears in the
`_generated_rights` is available for each object. The same applies to the other attributes.

The generated rights taken into account are: "read", "write", "delete" and "unlink". If the user has no "write" right, "unlink"
will not be tested, since they would not to be able to modify the object anyway. So, the possible values are:

```
{ [ "read", ["write", ["delete"], ["unlink"]] ] }
```

The `_available_tags` are only rendered with the attributes `_id` and `_is_default`.

The `_available_masks` are sorted by preference, according to the rules stated in [mask management](/en/technical/maskmanagement). Each entry
contains the mask name as `name` (string) and the mask ID as `_id` (integer). The mask "_all_fields" has no ID.

If the `pool_id` parameter is provided, the `available_tags` and `available_masks` will take into account this ID instead of
the current pool IDs of the objects.

If the `tag_ids` parameter is provided, the `available_tags` and `available_masks` will take into account these tags instead of
the current tags of the objects.

## HTTP status codes

|   |   |
|---|---|
| 200 | Success |
| 400 | [API error](/en/technical/errors): something is malformed |
| 400 | [Not Authenticated](/en/technical/errors): session is not authenticated |
| 500 | [Server error](/en/technical/errors): internal server error |


text:
snow-data
=========

    $ gem install snow-data [ -- [--warn-implicit-size] [--warn-no-bytesize] ]

Intro
-----

Snow-Data is a simple gem for dealing with memory and defining structs in a
C-like way. Incidentally, it's also hideously unsafe, so everything is tainted
by default. You'll thank me for this later, even if almost every operation does
bounds-checking where possible to ensure you're not being a horrible person.

For more information on usage, see the rdoc documentation for Snow::Memory
and Snow::CStruct, as it explains the important things. Like CStructs. And how
to talk to people. Ok, it can't help you with that.

_ALLONS-Y!_

Example
-------

For those wanting a quick-ish example of using snow-data, I'll include one here
showing you how you might define a few structs, including a Vec3, Vec2, Color,
and Vertex and working with those.

Bear in mind that, down the road, it will also be possible to assign snow-math
types to these as well (provided they use the same underlying types), though I
wouldn't use this for defining data types for anything other than transit to
another API that expects its data in a format like this.

How you use it, ultimately, is really up to you.

    #!/usr/bin/env ruby -w

    require 'snow-data'

    # Defines a struct { float x, y, z; } and a struct { float x, y; }, essentially,
    # all of whose members are 4-byte aligned (this is the default for floats, but
    # it helps to illustrate that you can specify alignment).
    Vec3   = Snow::CStruct[:Vec3, 'x: float :4; y: float :4; z: float :4']
    Vec2   = Snow::CStruct[:Vec2, 'x: float :4; y: float :4']
    # ui8 is shorthand for uint8_t -- you can write either, and the documentation
    # for CStruct::new explains the short- and long-form names for each primitive
    # type provided by Snow-Data. Further, CStructs defined with a name, as with
    # Vec3, Vec2, and Color, have getters and setters defined in the Memory class
    # and are usable as member types, as I'll show below.
    Color  = Snow::CStruct[:Color, 'r: ui8; g: ui8; b: ui8; a: ui8']

    # Define a vertex type whose members are all also 4-byte aligned. The vertex
    # itself has a position, a normal, two texcoords (e.g., diffuse and lightmap),
    # and a color value. Because we've not given Vertex a name (no :Vertex argument
    # to CStruct), it isn't usable as a type for struct members.
    Vertex = Snow::CStruct.new {
      vec3  :position,      align: 4
      vec3  :normal,        align: 4
      vec2  :texcoord, [2], align: 4
      color :color,         align: 4
    }

    def stringify_vertex(vertex)
      <<-VERTEX_DESCRIPTION
      Position:  #{vertex.position.to_h}
      Normal:    #{vertex.normal.to_h}
      Texcoords: [#{vertex.texcoord(0).to_h}, #{vertex.texcoord(1).to_h}]
      Color:     #{vertex.color.to_h}
      VERTEX_DESCRIPTION
    end

    # So let's create a vertex.
    a_vertex = Vertex.new { |v|
      v.position      = Vec3.new { |p| p.x = 1; p.y = 2; p.z = 3 }
      v.normal        = Vec3.new { |n| n.x = 0.707107; n.y = 0; n.z = 0.707107 }
      # For array types, we must use set_* functions, as the name= shorthand for
      # struct members only assigns to the first element of an array.
      v.texcoord      = Vec2.new { |t| t.x = 1.0; t.y = 1.0 }
      # This also works:
      v[:texcoord, 1] = Vec2.new { |t| t.x = 0.5; t.y = 0.5 }
      v.color         = Color.new { |c| c.r = 255; c.g = 127; c.b = 63; c.a = 220 }
    }

    puts "Our vertex:\n#{stringify_vertex a_vertex}"

    # For kicks, let's create an array.
    some_vertices = Vertex[64]

    # And set all vertices to the above vertex.
    some_vertices.map! { a_vertex }

    puts "Our vertex at index 36:\n#{stringify_vertex some_vertices[36]}"

License
-------

Snow-Data is licensed under a simplified BSD license, like most of my gems.

    Copyright (c) 2013, Noel Raymond Cower <ncower@gmail.com>.
    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice, this
       list of conditions and the following disclaimer.
    2. Redistributions in binary form must reproduce the above copyright notice,
       this list of conditions and the following disclaimer in the documentation
       and/or other materials provided with the distribution.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
    ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


text:
import Navbar from './navbar.vue';
import NavbarNav from './navbarNav.vue';
import NavItem from './navItem.vue';

export default {
  Navbar,
  NavbarNav,
  NavItem,
};


text:
![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png) 0

To use the Snow Report for Soldier Mountain skill, try saying...

* *Alexa, open Soldier Mountain*

* *Alexa, ask Soldier Mountain for the snow report*

* *Alexa, ask Soldier Mountain for latest conditions*

The Soldier Mountain Snow Report brought to you by SnoCountry brings you the latest snow fall, snow surface conditions,  base depth, trail, and lift operations information.

***

### Skill Details

* **Invocation Name:** soldier mountain
* **Category:** null
* **ID:** amzn1.ask.skill.257f35e3-0bf9-4dbc-a287-c33131a1bf8f
* **ASIN:** B01M3S9B66
* **Author:** SnoCountry
* **Release Date:** October 21, 2016 @ 14:17:07
* **In-App Purchasing:** No


text:
var tagListTable = function () {
    var tagTable;
    var $table = $("#dataTable");
    var handleRecords = function () {
        tagTable = new Datatable();
        tagTable.init({
            src: $table,
            onQuery: function (data) {
                data.tagName = $("#tagNameQuery").val();
            },

            onSortColumn: function (sortColumn, sortDirection) {
                switch (sortColumn) {
                    case "tagId":
                        sortColumn = "tag_id";
                        break;
                    case "tagName":
                        sortColumn = "tag_name";
                        break;
                }
                return customGlobal.onSortColumnDefault(sortColumn, sortDirection);
            },

            dataTable: {
                "ajax": {
                    "url": "tags/tagtype/getTagTypeListPage" // ajax source
                },
                "columns": [
                    {data: 'tagId', orderable: true, searchable: true},
                    {data: 'tagName', orderable: true, searchable: true},
                    {data: 'operate', orderable: false,
                        render: function (data, type, full) {
                            return '编辑 '
                                + '删除 ';
                        }
                    }
                ]
            }
        });
    };

    function validateError(regExp, target, message) {
        if (!new RegExp(regExp).test(target)) {
            toast.error(message);
            return false;
        } else {
            return true;
        }
    }

    var handletagEvent = {
        isEditable: true,
        showAddtag: function () {
            if (!handletagEvent.isEditable) {
                alert(handletagEvent.isEditable);
                console.log(handletagEvent.isEditable);
                toast.error("请添加完当前添加项");
                return;
            }

            $("#addtagForm").show();
            handletagEvent.isEditable = false;
        },

        hideAddtag: function () {
            $("#addtagForm").hide();
            handletagEvent.isEditable = true;
        },

        addtag: function () {
            var data = {
                tagName: $("#addTagName").val()
            };
            if (!validateError("^[0-9a-zA-Z\_]+$", data.tagName, "变量名称名称的数据只能包括字母数字下划线")) {
                return;
            }
            $.ajax({
                url: "tags/tagtype/add",
                type: "post",
                data: JSON.stringify(data),
                contentType: "application/json; charset=utf-8",
                success: function (data) {
                    if (customGlobal.ajaxCallback(data)) {
                        tagTable.reloadTable(false);
                        $("#addtagForm").hide();
                        handletagEvent.isEditable = true;
                        $("#addTagName").val("");
                    }
                }
            });
        },

        deletetag: function (table) {
            var $this = table;
            $("#confirmBtn").off("click.deleteRow").on("click.deleteRow", function () {
                $.ajax({
                    url: "tags/tagtype/" + $table.DataTable().row($this.parents('tr')[0]).data().tagId,
                    dataType: "json",
                    type: "DELETE",
                    success: function (data) {
                        $("#confirmDialog").modal("hide");
                        if (customGlobal.ajaxCallback(data)) {
                            tagTable.reloadTable(false);
                        }
                    }
                })
            })
        },

        showInput: function (table) {
            if (handletagEvent.isEditable == false) {
                toast.error("请完成当前编辑");
            }
            else {
                var nRow = table.parents('tr')[0];
                var tag = $table.DataTable().row(nRow).data();
                var jqTds = $('>td', nRow);
                jqTds[0].innerHTML = '<input type="text" id="updateTagId" class="form-control input-sm" readonly="true" value="' + tag.tagId + '">';
                jqTds[1].innerHTML = '<input type="text" id="updateTagName" class="form-control input-sm"  value="' + tag.tagName + '">';
                jqTds[2].innerHTML = '保存 ' +
                '取消';
                handletagEvent.isEditable = false;
            }
        },

        hideInput: function () {
            tagTable.reloadTable(false);
            handletagEvent.isEditable = true;
        },

        updatetag: function () {
            var data = {
                tagId: $("#updateTagId").val(),
                tagName: $("#updateTagName").val()
            };
            $.ajax({
                url:  "tags/tagtype",
                dataType: "json",
                type: "PUT",
                data: JSON.stringify(data),
                contentType: "application/json; charset=utf-8",
                success: function (data) {
                    if (customGlobal.ajaxCallback(data)) {
                        tagTable.reloadTable(true);
                        handletagEvent.isEditable = true;
                    }
                }
            });
        }
    };

    var handleEvent = function () {
        $("#showAddtag").on("click", handletagEvent.showAddtag);
        $("#addtagButton").live("click", handletagEvent.addtag);
        $("#cancelAdd").live("click", handletagEvent.hideAddtag);
        $table.on("click", "a.delete", function () {
            handletagEvent.deletetag($(this));
        });
        $table.on("click", "a.edit", function () {
            handletagEvent.showInput($(this));
        });
        $table.on("click", "a.update", handletagEvent.updatetag);
        $table.on("click", "a.cancel", handletagEvent.hideInput);
    };

    return {
        init: function () {
            handleRecords();
            handleEvent();
        }
    };
}();


text:
import stores from './stores'
import products from './products'

export {
  stores,
  products,
}


text:
require "rss-testcase"

require "rss/maker"

module RSS
  class TestMakerXMLStyleSheet < TestCase

    def test_xml_stylesheet
      href = 'a.xsl'
      type = 'text/xsl'
      title = 'sample'
      media = 'printer'
      charset = 'UTF-8'
      alternate = 'yes'

      rss = RSS::Maker.make("1.0") do |maker|
        maker.xml_stylesheets.new_xml_stylesheet do |xss|
          xss.href = href
          xss.type = type
          xss.title = title
          xss.media = media
          xss.charset = charset
          xss.alternate = alternate
        end

        setup_dummy_channel(maker)
      end

      xss = rss.xml_stylesheets.first
      assert_equal(href, xss.href)
      assert_equal(type, xss.type)
      assert_equal(title, xss.title)
      assert_equal(media, xss.media)
      assert_equal(charset, xss.charset)
      assert_equal(alternate, xss.alternate)

      href = 'http://example.com/index.xsl'
      type = 'text/xsl'
      rss = RSS::Maker.make("1.0") do |maker|
        maker.xml_stylesheets.new_xml_stylesheet do |xss|
          xss.href = href
        end

        setup_dummy_channel(maker)
      end

      xss = rss.xml_stylesheets.first
      assert_equal(href, xss.href)
      assert_equal(type, xss.type)
    end

    def test_not_valid_xml_stylesheet
      href = 'xss.XXX'
      type = "text/xsl"

      rss = RSS::Maker.make("1.0") do |maker|
        maker.xml_stylesheets.new_xml_stylesheet do |xss|
          # xss.href = href
          xss.type = type
        end

        setup_dummy_channel(maker)
      end
      assert(rss.xml_stylesheets.empty?)

      rss = RSS::Maker.make("1.0") do |maker|
        maker.xml_stylesheets.new_xml_stylesheet do |xss|
          xss.href = href
          # xss.type = type
        end

        setup_dummy_channel(maker)
      end
      assert(rss.xml_stylesheets.empty?)
    end

  end
end


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports._saveTaskConfigToDatabase = exports._getTaskConfig = exports._getTaskConfigModel = exports._setTaskConfigSchema = exports._setTaskConfig = exports._getTaskConfigSchema = exports._dbConn = undefined;

var _lodash = require('lodash');

var _lodash2 = _interopRequireDefault(_lodash);

var _mongoose = require('mongoose');

var _mongoose2 = _interopRequireDefault(_mongoose);

var _utils = require('./utils');

var _taskStateUtils = require('./taskStateUtils');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Schema = _mongoose2.default.Schema;

var configSchemaWithDefaults = {
  taskName: {
    type: String,
    default: ''
  },
  startedAt: {
    type: Date,
    default: new Date()
  },
  shouldRun: {
    type: Boolean,
    default: false
  }
};

var _dbConn = exports._dbConn = new WeakMap();
var _taskConfigSchemas = new WeakMap();
var _taskConfigModels = new WeakMap();
var _taskConfigs = new WeakMap();

var _getTaskConfigSchema = exports._getTaskConfigSchema = function _getTaskConfigSchema(taskName) {
  var self = this;
  var taskConfigSchemas = _taskConfigSchemas.get(self) || [];
  var taskConfigSchemaIndex = _lodash2.default.findIndex(taskConfigSchemas, function (schema) {
    return schema.taskName.default === taskName;
  });
  if (taskConfigSchemaIndex === -1) {
    _setTaskConfigSchema.call(self, taskName, {});
    return _getTaskConfigSchema.call(self, taskName);
  } else {
    return taskConfigSchemas[taskConfigSchemaIndex];
  }
};

var _setTaskConfig = exports._setTaskConfig = function _setTaskConfig(taskConfig) {
  var self = this;
  var taskName = taskConfig.taskName;
  var taskConfigs = _taskConfigs.get(self) || [];
  var taskConfigIndex = _lodash2.default.findIndex(taskConfigs, { taskName: taskName });
  if (taskConfigIndex === -1) {
    taskConfigs.push(taskConfig);
  } else {
    taskConfigs[taskConfigIndex] = taskConfig;
  }
  _taskConfigs.set(self, taskConfigs);
};

var _setTaskConfigSchema = exports._setTaskConfigSchema = function _setTaskConfigSchema(taskName, extendedConfigSchema) {
  var self = this;

  if (!_taskStateUtils._getTaskStatus.call(self, taskName)) {
    throw new Error(self.me + '.setExtendedTaskConfigSchema: Task "' + taskName + '" is not registered');
  }

  var taskConfigSchemas = _taskConfigSchemas.get(self) || [];
  var taskConfigSchemaIndex = _lodash2.default.findIndex(taskConfigSchemas, function (schema) {
    return schema.taskName.default === taskName;
  });

  var newConfigSchema = {
    taskName: {
      type: String,
      default: taskName
    }
  };
  newConfigSchema = _lodash2.default.merge({}, configSchemaWithDefaults, newConfigSchema, extendedConfigSchema);

  if (taskConfigSchemaIndex === -1) {
    taskConfigSchemas.push(newConfigSchema);
  } else {
    taskConfigSchemas[taskConfigSchemaIndex] = newConfigSchema;
  }

  _taskConfigSchemas.set(self, taskConfigSchemas);
  var defaultTaskConfig = (0, _utils.getObjectFromSchema)(newConfigSchema);
  defaultTaskConfig.hasBeenSavedtoDb = false;
  _setTaskConfig.call(self, defaultTaskConfig);
};

var _getTaskConfigModel = exports._getTaskConfigModel = function _getConfigModel(taskName) {
  var self = this;

  var taskConfigModels = _taskConfigModels.get(self) || [];
  var taskConfigModel = _lodash2.default.find(taskConfigModels, { taskName: taskName });
  if (taskConfigModel) {
    return taskConfigModel.configModel;
  }

  var taskConfigSchema = _getTaskConfigSchema.call(self, taskName);
  if (!taskConfigSchema) {
    throw new Error(self.me + '.getTaskConfigSchema: ConfigSchema not defined');
  }

  var configMongooseSchema = new Schema(taskConfigSchema, { collection: self.me + '.config' });
  if (!configMongooseSchema.hasOwnProperty('options')) configMongooseSchema.options = {};
  configMongooseSchema.options.toJSON = {
    transform: function transform(doc, ret, options) {
      delete ret._id;
      delete ret.__v;
      return ret;
    }
  };
  var dbConn = _dbConn.get(self);
  var newTaskConfigModel = dbConn.model(self.me + '.' + taskName, configMongooseSchema);
  taskConfigModels.push({
    taskName: taskName,
    configModel: newTaskConfigModel
  });
  _taskConfigModels.set(self, taskConfigModels);
  return newTaskConfigModel;
};

var _getTaskConfig = exports._getTaskConfig = function _getTaskConfig(taskName) {
  var self = this;
  var taskConfigs = _taskConfigs.get(self);
  return _lodash2.default.find(taskConfigs, { taskName: taskName });
};

var _saveTaskConfigToDatabase = exports._saveTaskConfigToDatabase = function _saveTaskConfigToDatabase(taskConfig, callback) {
  var self = this;
  var log = self.log;

  var newTaskConfig = _lodash2.default.cloneDeep(taskConfig);
  newTaskConfig.hasBeenSavedtoDb = false;
  _setTaskConfig.call(self, newTaskConfig);

  if (_lodash2.default.isUndefined(_dbConn.get(self))) {
    _lodash2.default.isFunction(callback) && callback(null);
    return null;
  }

  var taskName = newTaskConfig.taskName;
  var TaskConfigModel = _getTaskConfigModel.call(self, taskName);

  TaskConfigModel.update({ taskName: taskName }, newTaskConfig, { multi: true, upsert: true, setDefaultsOnInsert: true }, function (err, rawResponse) {
    if (err) {
      log.warning(self.me + '.' + taskName + '.saveConfigToDatabase: ' + err.message);
    } else {
      log.info(self.me + '.' + taskName + '.saveConfigToDatabase: Config saved to database');
      taskConfig.hasBeenSavedtoDb = true;
      _setTaskConfig.call(self, taskConfig);
    }

    _lodash2.default.isFunction(callback) && callback(err);
  });
};
//# sourceMappingURL=taskConfigUtils.js.map


text:
package life.catalogue.api.model;

import java.util.Objects;

import com.google.common.base.Preconditions;
import life.catalogue.api.vocab.TaxonomicStatus;

/**
 * A taxonomic synonym, linking a name to potentially multiple taxa.
 * Can be used for both homo-and heterotypic synonyms as well as misapplied names.
 */
public class Synonym extends NameUsageBase {

  private Taxon accepted;

  @Override
  public void setStatus(TaxonomicStatus status) {
    if (!Preconditions.checkNotNull(status).isSynonym()) {
      throw new IllegalArgumentException("Synonym status required");
    }
    super.setStatus(status);
  }

  /**
   * @return true if the synonym is a homotypic synonym for at least one of the accepted names.
   */
  public boolean isHomotypic() {
    return getName().getHomotypicNameId().equals(accepted.getName().getHomotypicNameId());
  }

  public Taxon getAccepted() {
    return accepted;
  }

  public void setAccepted(Taxon accepted) {
    this.accepted = accepted;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    if (!super.equals(o)) return false;
    Synonym synonym = (Synonym) o;
    return Objects.equals(accepted, synonym.accepted);
  }

  @Override
  public int hashCode() {
    return Objects.hash(super.hashCode(), accepted);
  }
}


text:
<?php

namespace App\Http\Controllers\Admin;

use App\Models\Article;
use Dimimo\S3\S3;

/**
 * Trait ArticlesTrait
 *
 * @package App\Http\Controllers\Admin
 */
trait ArticlesTrait
{
    /**
     * Get all articles (slow)
     *
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     * @throws \Illuminate\Auth\Access\AuthorizationException
     */
    public function allArticles()
    {
        $this->authorize('admin', \Auth::user());
        $articles = Article::orderByDesc('id')->get();
        $german   = false;
        $articles = $this->_pictureCount($articles);

        return view('admin.articles', compact('articles', 'german'));
    }

    /**
     * Get both 100 newest articles and German articles only
     *
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     * @throws \Illuminate\Auth\Access\AuthorizationException
     */
    public function articles()
    {
        $this->authorize('admin', \Auth::user());
        if (request()->get('lang') && request('lang') === 'de')
        {
            $articles = Article::where('lang', 'de')->orderByDesc('id')->get();
            $german   = true;
        } else
        {
            $articles = Article::orderByDesc('id')->limit(100)->get();
            $german   = false;
        }
        $articles = $this->_pictureCount($articles);

        return view('admin.articles', compact('articles', 'german'));
    }

    /**
     * Uploads pictures to the S3 server and updates the image count
     *
     * @return \Illuminate\Http\JsonResponse
     * @throws \Illuminate\Auth\Access\AuthorizationException
     */
    public function articleUpdate()
    {
        $data    = \Request::all();
        $article = Article::find($data['id']);
        $this->authorize('update', $article);
        $result = S3::file('articles/original')->updateArticle($article);
        //$result = ['done' => 8, 'failed' => 0];
        $result['failed'] != 0 ?
            $img_done = '' . $result['done'] . '' :
            $img_done = '' . $result['done'] . '';
        $result['failed'] != 0 ? $img_ext = '' :
            $img_ext = '';
        $result['failed'] != 0 ? $img_miss = '' . $result['failed'] . '' :
            $img_miss = '';

        return response()->json(['type' => 'success', 'id' => $article->id, 'img_done' => $img_done, 'img_ext' => $img_ext, 'img_miss' => $img_miss]);
    }

    /**
     * @param \Illuminate\Database\Eloquent\Collection $articles
     *
     * @return mixed
     */
    private function _pictureCount($articles)
    {
        $pattern_raw = "/]+)(?:'|\")/i";
        foreach ($articles as $article)
        {
            $count = $img_done = 0;
            preg_match_all($pattern_raw, $article->body, $matches);
            if ($article->picture_url)
            {
                $matches[1][] = $article->picture_url;
            }
            if ($matches)
            {
                $matches = array_unique($matches[1]);
                $count   = count($matches);
                foreach ($matches as $match)
                {
                    //file is already on S3
                    if (strstr($match, config('s3.images_url')) || preg_match('@^\/img\/@i', $match))
                    {
                        $img_done ++;
                        continue;
                    }
                }
            }
            $count !== $img_done ? $img_ext = $img_miss = '' :
                $img_ext = $img_miss = '';
            $article->setAttribute('img_count', $count);
            $count !== $img_done ? $article->setAttribute('img_done', '' . $img_done . '') :
                $article->setAttribute('img_done', '' . $img_done . '');
            $article->setAttribute('img_ext', $img_ext);
            $article->setAttribute('img_miss', $img_miss);
            $count !== $img_done ? $article->setAttribute('img_edit',
                                                          'id . '">') :
                $article->setAttribute('img_edit', '');
        }

        return $articles;
    }
}


text:
FROM busybox

MAINTAINER "Eliran Bivas" "http://github.com/bivas/docker-serf-wrapper"

ADD https://dl.bintray.com/mitchellh/serf/0.6.2_linux_amd64.zip serf.zip
RUN unzip serf.zip -d /usr/bin
RUN chmod +x /usr/bin/serf
RUN rm -rf serf.zip

ADD /serf-join.sh /serf-join.sh
RUN chmod +x /serf-join.sh

EXPOSE 7373
EXPOSE 7946
ENTRYPOINT ["/serf-join.sh"]


text:
The core vocabulary should be a limited set of words on which a wider language lexicon is been built. The basic premise is that there should be a reasonably short list of words to learn and memorize. Obviously there is a balance to strike between expressivity and size. The core language should be abstract and ambiguous. The language assumes a context that would clarify some ambiguity (for instance on Earth the time unit may be second).

Words are organized in sequence of up to 12 words.

Checklist for a sequence of 12 words:

- [ ] The sequence should be thematic.
- [ ] The order of these words is coherent, and follow one of these patterns:
    - Incremental: the first word is related to 0 or 1 and the last word to 11 or 12.
    - Alphabetic order of the sequence words.
    - A list of pairs (ex: uneasy easy), where the two parts of the pair are antonyms. The first word of the pair should represent negative (0) aspect while second word the positive (1) aspect. Whenever possible the second word (positive) should be used to sort the tuples alphabetically. (negative words often starts with same prefix and make them a bad fit for sorting).
- [ ] The sequence is reasonably easy to remember.
- [ ] The sequence helps to narrow down a meaning.

Checklist for a word in the core vocabulary:
- [ ] The word is abstract enough.
- [ ] The word is not specific to Earth and would be relevant for most planets. For example, not every planet would have tigers or Japan, but they could have mammals and countries.
- [ ] The word is useful for adding meaning to other words the same way a prefix or suffix in English would be.
- [ ] The word is a known mathematical, physical, computing concept that would always be relevant.
- [ ] The word could be poetically used for similar concepts in different fields.
- [ ] Synonyms in the core vocabulary should be avoided unless they play a role in a sequence.
- [ ] The word should be frequently used in the resulting language. A niche word should be discarded if it could be easily replaced by another word or combination of words in the core vocabulary.
- [ ] The word does not have a more common synonym.