text:
namespace remoting {
namespace protocol {

NegotiatingClientAuthenticator::NegotiatingClientAuthenticator(
    const std::string& client_pairing_id,
    const std::string& shared_secret,
    const std::string& authentication_tag,
    const FetchSecretCallback& fetch_secret_callback,
    scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher> token_fetcher)
    : NegotiatingAuthenticatorBase(MESSAGE_READY),
      client_pairing_id_(client_pairing_id),
      shared_secret_(shared_secret),
      authentication_tag_(authentication_tag),
      fetch_secret_callback_(fetch_secret_callback),
      token_fetcher_(std::move(token_fetcher)),
      weak_factory_(this) {
  AddMethod(Method::THIRD_PARTY);
  AddMethod(Method::SPAKE2_PAIR);
  AddMethod(Method::SPAKE2_SHARED_SECRET_HMAC);
  AddMethod(Method::SPAKE2_SHARED_SECRET_PLAIN);
}

NegotiatingClientAuthenticator::~NegotiatingClientAuthenticator() {}

void NegotiatingClientAuthenticator::ProcessMessage(
    const buzz::XmlElement* message,
    const base::Closure& resume_callback) {
  DCHECK_EQ(state(), WAITING_MESSAGE);

  std::string method_attr = message->Attr(kMethodAttributeQName);
  Method method = ParseMethodString(method_attr);

  // The host picked a method different from the one the client had selected.
  if (method != current_method_) {
    // The host must pick a method that is valid and supported by the client,
    // and it must not change methods after it has picked one.
    if (method_set_by_host_ || method == Method::INVALID ||
        std::find(methods_.begin(), methods_.end(), method) == methods_.end()) {
      state_ = REJECTED;
      rejection_reason_ = PROTOCOL_ERROR;
      resume_callback.Run();
      return;
    }

    current_method_ = method;
    method_set_by_host_ = true;
    state_ = PROCESSING_MESSAGE;

    // Copy the message since the authenticator may process it asynchronously.
    base::Closure callback = base::Bind(
        &NegotiatingAuthenticatorBase::ProcessMessageInternal,
        base::Unretained(this), base::Owned(new buzz::XmlElement(*message)),
        resume_callback);
    CreateAuthenticatorForCurrentMethod(WAITING_MESSAGE, callback);
    return;
  }
  ProcessMessageInternal(message, resume_callback);
}

scoped_ptr<buzz::XmlElement> NegotiatingClientAuthenticator::GetNextMessage() {
  DCHECK_EQ(state(), MESSAGE_READY);

  // This is the first message to the host, send a list of supported methods.
  if (current_method_ == Method::INVALID) {
    // If no authentication method has been chosen, see if we can optimistically
    // choose one.
    scoped_ptr<buzz::XmlElement> result;
    CreatePreferredAuthenticator();
    if (current_authenticator_) {
      DCHECK(current_authenticator_->state() == MESSAGE_READY);
      result = GetNextMessageInternal();
    } else {
      result = CreateEmptyAuthenticatorMessage();
    }

    // Include a list of supported methods.
    std::string supported_methods;
    for (Method method : methods_) {
      if (!supported_methods.empty())
        supported_methods += kSupportedMethodsSeparator;
      supported_methods += MethodToString(method);
    }
    result->AddAttr(kSupportedMethodsAttributeQName, supported_methods);
    state_ = WAITING_MESSAGE;
    return result;
  }
  return GetNextMessageInternal();
}

void NegotiatingClientAuthenticator::CreateAuthenticatorForCurrentMethod(
    Authenticator::State preferred_initial_state,
    const base::Closure& resume_callback) {
  DCHECK(current_method_ != Method::INVALID);
  if (current_method_ == Method::THIRD_PARTY) {
    // |ThirdPartyClientAuthenticator| takes ownership of |token_fetcher_|.
    // The authentication method negotiation logic should guarantee that only
    // one |ThirdPartyClientAuthenticator| will need to be created per session.
    DCHECK(token_fetcher_);
    current_authenticator_.reset(new ThirdPartyClientAuthenticator(
        base::Bind(&V2Authenticator::CreateForClient),
        std::move(token_fetcher_)));
    resume_callback.Run();
  } else {
    DCHECK(current_method_ == Method::SPAKE2_SHARED_SECRET_PLAIN ||
           current_method_ == Method::SPAKE2_PAIR ||
           current_method_ == Method::SPAKE2_SHARED_SECRET_HMAC);
    bool pairing_supported = (current_method_ == Method::SPAKE2_PAIR);
    SecretFetchedCallback callback = base::Bind(
        &NegotiatingClientAuthenticator::CreateV2AuthenticatorWithSecret,
        weak_factory_.GetWeakPtr(), preferred_initial_state, resume_callback);
    fetch_secret_callback_.Run(pairing_supported, callback);
  }
}

void NegotiatingClientAuthenticator::CreatePreferredAuthenticator() {
  if (!client_pairing_id_.empty() && !shared_secret_.empty() &&
      std::find(methods_.begin(), methods_.end(), Method::SPAKE2_PAIR) !=
          methods_.end()) {
    // If the client specified a pairing id and shared secret, then create a
    // PairingAuthenticator.
    current_authenticator_.reset(new PairingClientAuthenticator(
        client_pairing_id_, shared_secret_,
        base::Bind(&V2Authenticator::CreateForClient), fetch_secret_callback_,
        authentication_tag_));
    current_method_ = Method::SPAKE2_PAIR;
  }
}

void NegotiatingClientAuthenticator::CreateV2AuthenticatorWithSecret(
    Authenticator::State initial_state,
    const base::Closure& resume_callback,
    const std::string& shared_secret) {
  current_authenticator_ = V2Authenticator::CreateForClient(
      (current_method_ == Method::SPAKE2_SHARED_SECRET_PLAIN)
          ? shared_secret
          : GetSharedSecretHash(authentication_tag_, shared_secret),
      initial_state);
  resume_callback.Run();
}

}  // namespace protocol
}  // namespace remoting

redpajama_set_name: RedPajamaGithub


text:
package routing

import "net/http"

// HTTPError represents an HTTP error with HTTP status code and error message
type HTTPError interface {
	error
	// StatusCode returns the HTTP status code of the error
	StatusCode() int
}

// Error contains the error information reported by calling Context.Error().
type httpError struct {
	Status  int    `json:"status" xml:"status"`
	Message string `json:"message" xml:"message"`
}

// NewHTTPError creates a new HttpError instance.
// If the error message is not given, http.StatusText() will be called
// to generate the message based on the status code.
func NewHTTPError(status int, message ...string) HTTPError {
	if len(message) > 0 {
		return &httpError{status, message[0]}
	}
	return &httpError{status, http.StatusText(status)}
}

// Error returns the error message.
func (e *httpError) Error() string {
	return e.Message
}

// StatusCode returns the HTTP status code.
func (e *httpError) StatusCode() int {
	return e.Status
}


text:
package tlog

import (
	"fmt"
	"strconv"
	"strings"
)

// A Tile is a description of a transparency log tile.
// A tile of height H at level L offset N lists W consecutive hashes
// at level H*L of the tree starting at offset N*(2**H).
// A complete tile lists 2**H hashes; a partial tile lists fewer.
// Note that a tile represents the entire subtree of height H
// with those hashes as the leaves. The levels above H*L
// can be reconstructed by hashing the leaves.
//
// Each Tile can be encoded as a "tile coordinate path"
// of the form tile/H/L/NNN[.p/W].
// The .p/W suffix is present only for partial tiles, meaning W < 2**H.
// The NNN element is an encoding of N into 3-digit path elements.
// All but the last path element begins with an "x".
// For example,
// Tile{H: 3, L: 4, N: 1234067, W: 1}'s path
// is tile/3/4/x001/x234/067.p/1, and
// Tile{H: 3, L: 4, N: 1234067, W: 8}'s path
// is tile/3/4/x001/x234/067.
// See Tile's Path method and the ParseTilePath function.
//
// The special level L=-1 holds raw record data instead of hashes.
// In this case, the level encodes into a tile path as the path element
// "data" instead of "-1".
//
// See also https://golang.org/design/25530-sumdb#checksum-database
// and https://research.swtch.com/tlog#tiling_a_log.
type Tile struct {
	H int   // height of tile (1 ≤ H ≤ 30)
	L int   // level in tiling (-1 ≤ L ≤ 63)
	N int64 // number within level (0 ≤ N, unbounded)
	W int   // width of tile (1 ≤ W ≤ 2**H; 2**H is complete tile)
}

// TileForIndex returns the tile of fixed height h ≥ 1
// and least width storing the given hash storage index.
//
// If h ≤ 0, TileForIndex panics.
func TileForIndex(h int, index int64) Tile {
	if h <= 0 {
		panic(fmt.Sprintf("TileForIndex: invalid height %d", h))
	}
	t, _, _ := tileForIndex(h, index)
	return t
}

// tileForIndex returns the tile of height h ≥ 1
// storing the given hash index, which can be
// reconstructed using tileHash(data[start:end]).
func tileForIndex(h int, index int64) (t Tile, start, end int) {
	level, n := SplitStoredHashIndex(index)
	t.H = h
	t.L = level / h
	level -= t.L * h // now level within tile
	t.N = n << uint(level) >> uint(t.H)
	n -= t.N << uint(t.H) >> uint(level) // now n within tile at level
	t.W = int((n + 1) << uint(level))
	return t, int(n<<uint(level)) * HashSize, int((n+1)<<uint(level)) * HashSize
}

// HashFromTile returns the hash at the given storage index,
// provided that t == TileForIndex(t.H, index) or a wider version,
// and data is t's tile data (of length at least t.W*HashSize).
func HashFromTile(t Tile, data []byte, index int64) (Hash, error) {
	if t.H < 1 || t.H > 30 || t.L < 0 || t.L >= 64 || t.W < 1 || t.W > 1<<uint(t.H) {
		return Hash{}, fmt.Errorf("invalid tile %v", t.Path())
	}
	if len(data) < t.W*HashSize {
		return Hash{}, fmt.Errorf("data len %d too short for tile %v", len(data), t.Path())
	}
	t1, start, end := tileForIndex(t.H, index)
	if t.L != t1.L || t.N != t1.N || t.W < t1.W {
		return Hash{}, fmt.Errorf("index %v is in %v not %v", index, t1.Path(), t.Path())
	}
	return tileHash(data[start:end]), nil
}

// tileHash computes the subtree hash corresponding to the (2^K)-1 hashes in data.
func tileHash(data []byte) Hash {
	if len(data) == 0 {
		panic("bad math in tileHash")
	}
	if len(data) == HashSize {
		var h Hash
		copy(h[:], data)
		return h
	}
	n := len(data) / 2
	return NodeHash(tileHash(data[:n]), tileHash(data[n:]))
}

// NewTiles returns the coordinates of the tiles of height h ≥ 1
// that must be published when publishing from a tree of
// size newTreeSize to replace a tree of size oldTreeSize.
// (No tiles need to be published for a tree of size zero.)
//
// If h ≤ 0, TileForIndex panics.
func NewTiles(h int, oldTreeSize, newTreeSize int64) []Tile {
	if h <= 0 {
		panic(fmt.Sprintf("NewTiles: invalid height %d", h))
	}
	H := uint(h)
	var tiles []Tile
	for level := uint(0); newTreeSize>>(H*level) > 0; level++ {
		oldN := oldTreeSize >> (H * level)
		newN := newTreeSize >> (H * level)
		for n := oldN >> H; n < newN>>H; n++ {
			tiles = append(tiles, Tile{H: h, L: int(level), N: n, W: 1 << H})
		}
		n := newN >> H
		maxW := int(newN - n<<H)
		minW := 1
		if oldN > n<<H {
			minW = int(oldN - n<<H)
		}
		for w := minW; w <= maxW; w++ {
			tiles = append(tiles, Tile{H: h, L: int(level), N: n, W: w})
		}
	}
	return tiles
}

// ReadTileData reads the hashes for tile t from r
// and returns the corresponding tile data.
func ReadTileData(t Tile, r HashReader) ([]byte, error) {
	size := t.W
	if size == 0 {
		size = 1 << uint(t.H)
	}
	start := t.N << uint(t.H)
	indexes := make([]int64, size)
	for i := 0; i < size; i++ {
		indexes[i] = StoredHashIndex(t.H*t.L, start+int64(i))
	}

	hashes, err := r.ReadHashes(indexes)
	if err != nil {
		return nil, err
	}
	if len(hashes) != len(indexes) {
		return nil, fmt.Errorf("tlog: ReadHashes(%d indexes) = %d hashes", len(indexes), len(hashes))
	}

	tile := make([]byte, size*HashSize)
	for i := 0; i < size; i++ {
		copy(tile[i*HashSize:], hashes[i][:])
	}
	return tile, nil
}

// To limit the size of any particular directory listing,
// we encode the (possibly very large) number N
// by encoding three digits at a time.
// For example, 123456789 encodes as x123/x456/789.
// Each directory has at most 1000 each xNNN, NNN, and NNN.p children,
// so there are at most 3000 entries in any one directory.
const pathBase = 1000

// Path returns a tile coordinate path describing t.
func (t Tile) Path() string {
	n := t.N
	nStr := fmt.Sprintf("%03d", n%pathBase)
	for n >= pathBase {
		n /= pathBase
		nStr = fmt.Sprintf("x%03d/%s", n%pathBase, nStr)
	}
	pStr := ""
	if t.W != 1<<uint(t.H) {
		pStr = fmt.Sprintf(".p/%d", t.W)
	}
	var L string
	if t.L == -1 {
		L = "data"
	} else {
		L = fmt.Sprintf("%d", t.L)
	}
	return fmt.Sprintf("tile/%d/%s/%s%s", t.H, L, nStr, pStr)
}

// ParseTilePath parses a tile coordinate path.
func ParseTilePath(path string) (Tile, error) {
	f := strings.Split(path, "/")
	if len(f) < 4 || f[0] != "tile" {
		return Tile{}, &badPathError{path}
	}
	h, err1 := strconv.Atoi(f[1])
	isData := false
	if f[2] == "data" {
		isData = true
		f[2] = "0"
	}
	l, err2 := strconv.Atoi(f[2])
	if err1 != nil || err2 != nil || h < 1 || l < 0 || h > 30 {
		return Tile{}, &badPathError{path}
	}
	w := 1 << uint(h)
	if dotP := f[len(f)-2]; strings.HasSuffix(dotP, ".p") {
		ww, err := strconv.Atoi(f[len(f)-1])
		if err != nil || ww <= 0 || ww >= w {
			return Tile{}, &badPathError{path}
		}
		w = ww
		f[len(f)-2] = dotP[:len(dotP)-len(".p")]
		f = f[:len(f)-1]
	}
	f = f[3:]
	n := int64(0)
	for _, s := range f {
		nn, err := strconv.Atoi(strings.TrimPrefix(s, "x"))
		if err != nil || nn < 0 || nn >= pathBase {
			return Tile{}, &badPathError{path}
		}
		n = n*pathBase + int64(nn)
	}
	if isData {
		l = -1
	}
	t := Tile{H: h, L: l, N: n, W: w}
	if path != t.Path() {
		return Tile{}, &badPathError{path}
	}
	return t, nil
}

type badPathError struct {
	path string
}

func (e *badPathError) Error() string {
	return fmt.Sprintf("malformed tile path %q", e.path)
}

// A TileReader reads tiles from a go.sum database log.
type TileReader interface {
	// Height returns the height of the available tiles.
	Height() int

	// ReadTiles returns the data for each requested tile.
	// If ReadTiles returns err == nil, it must also return
	// a data record for each tile (len(data) == len(tiles))
	// and each data record must be the correct length
	// (len(data[i]) == tiles[i].W*HashSize).
	//
	// An implementation of ReadTiles typically reads
	// them from an on-disk cache or else from a remote
	// tile server. Tile data downloaded from a server should
	// be considered suspect and not saved into a persistent
	// on-disk cache before returning from ReadTiles.
	// When the client confirms the validity of the tile data,
	// it will call SaveTiles to signal that they can be safely
	// written to persistent storage.
	// See also https://research.swtch.com/tlog#authenticating_tiles.
	ReadTiles(tiles []Tile) (data [][]byte, err error)

	// SaveTiles informs the TileReader that the tile data
	// returned by ReadTiles has been confirmed as valid
	// and can be saved in persistent storage (on disk).
	SaveTiles(tiles []Tile, data [][]byte)
}

// TileHashReader returns a HashReader that satisfies requests
// by loading tiles of the given tree.
//
// The returned HashReader checks that loaded tiles are
// valid for the given tree. Therefore, any hashes returned
// by the HashReader are already proven to be in the tree.
func TileHashReader(tree Tree, tr TileReader) HashReader {
	return &tileHashReader{tree: tree, tr: tr}
}

type tileHashReader struct {
	tree Tree
	tr   TileReader
}

// tileParent returns t's k'th tile parent in the tiles for a tree of size n.
// If there is no such parent, tileParent returns Tile{}.
func tileParent(t Tile, k int, n int64) Tile {
	t.L += k
	t.N >>= uint(k * t.H)
	t.W = 1 << uint(t.H)
	if max := n >> uint(t.L*t.H); t.N<<uint(t.H)+int64(t.W) >= max {
		if t.N<<uint(t.H) >= max {
			return Tile{}
		}
		t.W = int(max - t.N<<uint(t.H))
	}
	return t
}

func (r *tileHashReader) ReadHashes(indexes []int64) ([]Hash, error) {
	h := r.tr.Height()

	tileOrder := make(map[Tile]int) // tileOrder[tileKey(tiles[i])] = i
	var tiles []Tile

	// Plan to fetch tiles necessary to recompute tree hash.
	// If it matches, those tiles are authenticated.
	stx := subTreeIndex(0, r.tree.N, nil)
	stxTileOrder := make([]int, len(stx))
	for i, x := range stx {
		tile, _, _ := tileForIndex(h, x)
		tile = tileParent(tile, 0, r.tree.N)
		if j, ok := tileOrder[tile]; ok {
			stxTileOrder[i] = j
			continue
		}
		stxTileOrder[i] = len(tiles)
		tileOrder[tile] = len(tiles)
		tiles = append(tiles, tile)
	}

	// Plan to fetch tiles containing the indexes,
	// along with any parent tiles needed
	// for authentication. For most calls,
	// the parents are being fetched anyway.
	indexTileOrder := make([]int, len(indexes))
	for i, x := range indexes {
		if x >= StoredHashIndex(0, r.tree.N) {
			return nil, fmt.Errorf("indexes not in tree")
		}

		tile, _, _ := tileForIndex(h, x)

		// Walk up parent tiles until we find one we've requested.
		// That one will be authenticated.
		k := 0
		for ; ; k++ {
			p := tileParent(tile, k, r.tree.N)
			if j, ok := tileOrder[p]; ok {
				if k == 0 {
					indexTileOrder[i] = j
				}
				break
			}
		}

		// Walk back down recording child tiles after parents.
		// This loop ends by revisiting the tile for this index
		// (tileParent(tile, 0, r.tree.N)) unless k == 0, in which
		// case the previous loop did it.
		for k--; k >= 0; k-- {
			p := tileParent(tile, k, r.tree.N)
			if p.W != 1<<uint(p.H) {
				// Only full tiles have parents.
				// This tile has a parent, so it must be full.
				return nil, fmt.Errorf("bad math in tileHashReader: %d %d %v", r.tree.N, x, p)
			}
			tileOrder[p] = len(tiles)
			if k == 0 {
				indexTileOrder[i] = len(tiles)
			}
			tiles = append(tiles, p)
		}
	}

	// Fetch all the tile data.
	data, err := r.tr.ReadTiles(tiles)
	if err != nil {
		return nil, err
	}
	if len(data) != len(tiles) {
		return nil, fmt.Errorf("TileReader returned bad result slice (len=%d, want %d)", len(data), len(tiles))
	}
	for i, tile := range tiles {
		if len(data[i]) != tile.W*HashSize {
			return nil, fmt.Errorf("TileReader returned bad result slice (%v len=%d, want %d)", tile.Path(), len(data[i]), tile.W*HashSize)
		}
	}

	// Authenticate the initial tiles against the tree hash.
	// They are arranged so that parents are authenticated before children.
	// First the tiles needed for the tree hash.
	th, err := HashFromTile(tiles[stxTileOrder[len(stx)-1]], data[stxTileOrder[len(stx)-1]], stx[len(stx)-1])
	if err != nil {
		return nil, err
	}
	for i := len(stx) - 2; i >= 0; i-- {
		h, err := HashFromTile(tiles[stxTileOrder[i]], data[stxTileOrder[i]], stx[i])
		if err != nil {
			return nil, err
		}
		th = NodeHash(h, th)
	}
	if th != r.tree.Hash {
		// The tiles do not support the tree hash.
		// We know at least one is wrong, but not which one.
		return nil, fmt.Errorf("downloaded inconsistent tile")
	}

	// Authenticate full tiles against their parents.
	for i := len(stx); i < len(tiles); i++ {
		tile := tiles[i]
		p := tileParent(tile, 1, r.tree.N)
		j, ok := tileOrder[p]
		if !ok {
			return nil, fmt.Errorf("bad math in tileHashReader %d %v: lost parent of %v", r.tree.N, indexes, tile)
		}
		h, err := HashFromTile(p, data[j], StoredHashIndex(p.L*p.H, tile.N))
		if err != nil {
			return nil, fmt.Errorf("bad math in tileHashReader %d %v: lost hash of %v: %v", r.tree.N, indexes, tile, err)
		}
		if h != tileHash(data[i]) {
			return nil, fmt.Errorf("downloaded inconsistent tile")
		}
	}

	// Now we have all the tiles needed for the requested hashes,
	// and we've authenticated the full tile set against the trusted tree hash.
	r.tr.SaveTiles(tiles, data)

	// Pull out the requested hashes.
	hashes := make([]Hash, len(indexes))
	for i, x := range indexes {
		j := indexTileOrder[i]
		h, err := HashFromTile(tiles[j], data[j], x)
		if err != nil {
			return nil, fmt.Errorf("bad math in tileHashReader %d %v: lost hash %v: %v", r.tree.N, indexes, x, err)
		}
		hashes[i] = h
	}

	return hashes, nil
}


text:
namespace Google.Cloud.AIPlatform.V1.Snippets
{
    // [START aiplatform_v1_generated_SpecialistPoolService_GetSpecialistPool_sync_flattened_resourceNames]
    using Google.Cloud.AIPlatform.V1;

    public sealed partial class GeneratedSpecialistPoolServiceClientSnippets
    {
        /// <summary>Snippet for GetSpecialistPool</summary>
        /// <remarks>
        /// This snippet has been automatically generated and should be regarded as a code template only.
        /// It will require modifications to work:
        /// - It may require correct/in-range values for request initialization.
        /// - It may require specifying regional endpoints when creating the service client as shown in
        ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
        /// </remarks>
        public void GetSpecialistPoolResourceNames()
        {
            // Create client
            SpecialistPoolServiceClient specialistPoolServiceClient = SpecialistPoolServiceClient.Create();
            // Initialize request argument(s)
            SpecialistPoolName name = SpecialistPoolName.FromProjectLocationSpecialistPool("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]");
            // Make the request
            SpecialistPool response = specialistPoolServiceClient.GetSpecialistPool(name);
        }
    }
    // [END aiplatform_v1_generated_SpecialistPoolService_GetSpecialistPool_sync_flattened_resourceNames]
}


text:
package com.jonathancolt.nicity.view.event;

/*
 * #%L
 * nicity-view
 * %%
 * Copyright (C) 2013 Jonathan Colt
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

/**
 *
 * @author Administrator
 */
public class MouseWheel extends AMouseEvent {

    private int scrollType;
    private int scrollAmount;
    private int wheelRotation;

    /**
     *
     * @param _who
     * @param source
     * @param x
     * @param y
     * @param clickCount
     * @param modifiers
     * @param _scrollType
     * @param _scrollAmount
     * @param _wheelRotation
     * @param _cx
     * @param _cy
     * @param _cw
     * @param _ch
     * @return
     */
    public static AMouseEvent newInstance(
            long _who,
            Object source,
            int x, int y,
            int clickCount, int modifiers,
            int _scrollType, int _scrollAmount, int _wheelRotation,
            float _cx, float _cy, float _cw, float _ch) {
        MouseWheel e = new MouseWheel();
        e.who = _who;
        e.setSource(source);
        e.setX(x);
        e.setY(y);
        e.setClickCount(clickCount);
        e.setModifiers(modifiers);

        e.scrollType = _scrollType;
        e.scrollAmount = _scrollAmount;
        e.wheelRotation = _wheelRotation;

        e.cx = _cx;
        e.cy = _cy;
        e.cw = _cw;
        e.ch = _ch;
        e.isDragging = false;
        return e;
    }

    /**
     *
     * @return
     */
    public int getScrollType() {
        return scrollType;
    }

    /**
     *
     * @return
     */
    public int getScrollAmount() {
        return scrollAmount;
    }

    /**
     *
     * @return
     */
    public int getWheelRotation() {
        return wheelRotation;
    }
}


text:
package jsettlers.network.client.interfaces;

/**
 * This interface supplies a method to check if the game is pausing.
 *
 * @author Andreas Eberle
 *
 */
public interface IPausingSupplier {

	/**
	 *
	 * @return Returns true if the game's clock is pausing<br>
	 *         false otherwise.
	 */
	boolean isPausing();
}


text:
package org.apache.mahout.classifier.sgd;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Locale;

import org.apache.commons.cli2.CommandLine;
import org.apache.commons.cli2.Group;
import org.apache.commons.cli2.Option;
import org.apache.commons.cli2.builder.ArgumentBuilder;
import org.apache.commons.cli2.builder.DefaultOptionBuilder;
import org.apache.commons.cli2.builder.GroupBuilder;
import org.apache.commons.cli2.commandline.Parser;
import org.apache.commons.cli2.util.HelpFormatter;
import org.apache.mahout.classifier.sgd.AdaptiveLogisticRegression.Wrapper;
import org.apache.mahout.ep.State;
import org.apache.mahout.math.RandomAccessSparseVector;
import org.apache.mahout.math.Vector;

import com.google.common.base.Charsets;
import com.google.common.collect.Lists;
import com.google.common.io.Resources;

public final class TrainAdaptiveLogistic {

  private static String inputFile;
  private static String outputFile;
  private static AdaptiveLogisticModelParameters lmp;
  private static int passes;
  private static boolean showperf;
  private static int skipperfnum = 99;
  private static AdaptiveLogisticRegression model;

  private TrainAdaptiveLogistic() {
  }

  public static void main(String[] args) throws Exception {
    mainToOutput(args, new PrintWriter(System.out, true));
  }

  static void mainToOutput(String[] args, PrintWriter output) throws Exception {
    if (parseArgs(args)) {

      CsvRecordFactory csv = lmp.getCsvRecordFactory();
      model = lmp.createAdaptiveLogisticRegression();
      State<Wrapper, CrossFoldLearner> best;
      CrossFoldLearner learner = null;

      int k = 0;
      for (int pass = 0; pass < passes; pass++) {
        BufferedReader in = open(inputFile);

        // read variable names
        csv.firstLine(in.readLine());

        String line = in.readLine();
        int lineCount = 2;
        while (line != null) {
          // for each new line, get target and predictors
          Vector input = new RandomAccessSparseVector(lmp.getNumFeatures());
          int targetValue = csv.processLine(line, input);

          // update model
          model.train(targetValue, input);
          k++;

          if (showperf && (k % (skipperfnum + 1) == 0)) {

            best = model.getBest();
            if (best != null) {
              learner = best.getPayload().getLearner();
            }
            if (learner != null) {
              double averageCorrect = learner.percentCorrect();
              double averageLL = learner.logLikelihood();
              output.printf("%d\t%.3f\t%.2f\n",
                            k, averageLL, averageCorrect * 100);
            } else {
              output.printf(Locale.ENGLISH,
                            "%10d %2d %s\n", k, targetValue,
                            "AdaptiveLogisticRegression has not found a good model ......");
            }
          }
          line = in.readLine();
          lineCount++;
        }
        in.close();
      }

      best = model.getBest();
      if (best != null) {
        learner = best.getPayload().getLearner();
      }
      if (learner == null) {
        output.printf(Locale.ENGLISH,
                      "%s\n", "AdaptiveLogisticRegression has failed to train a model.");
        return;
      }

      OutputStream modelOutput = new FileOutputStream(outputFile);
      try {
        lmp.saveTo(modelOutput);
      } finally {
        modelOutput.close();
      }

      OnlineLogisticRegression lr = learner.getModels().get(0);
      output.printf(Locale.ENGLISH, "%d\n", lmp.getNumFeatures());
      output.printf(Locale.ENGLISH, "%s ~ ", lmp.getTargetVariable());
      String sep = "";
      for (String v : csv.getTraceDictionary().keySet()) {
        double weight = predictorWeight(lr, 0, csv, v);
        if (weight != 0) {
          output.printf(Locale.ENGLISH, "%s%.3f*%s", sep, weight, v);
          sep = " + ";
        }
      }
      output.printf("\n");

      for (int row = 0; row < lr.getBeta().numRows(); row++) {
        for (String key : csv.getTraceDictionary().keySet()) {
          double weight = predictorWeight(lr, row, csv, key);
          if (weight != 0) {
            output.printf(Locale.ENGLISH, "%20s %.5f\n", key, weight);
          }
        }
        for (int column = 0; column < lr.getBeta().numCols(); column++) {
          output.printf(Locale.ENGLISH, "%15.9f ", lr.getBeta().get(row, column));
        }
        output.println();
      }
    }

  }

  private static double predictorWeight(OnlineLogisticRegression lr, int row, RecordFactory csv, String predictor) {
    double weight = 0;
    for (Integer column : csv.getTraceDictionary().get(predictor)) {
      weight += lr.getBeta().get(row, column);
    }
    return weight;
  }

  private static boolean parseArgs(String[] args) {
    DefaultOptionBuilder builder = new DefaultOptionBuilder();

    Option help = builder.withLongName("help")
        .withDescription("print this list").create();

    Option quiet = builder.withLongName("quiet")
        .withDescription("be extra quiet").create();

    ArgumentBuilder argumentBuilder = new ArgumentBuilder();
    Option showperf = builder
      .withLongName("showperf")
      .withDescription("output performance measures during training")
      .create();

    Option inputFile = builder
        .withLongName("input")
        .withRequired(true)
        .withArgument(
            argumentBuilder.withName("input").withMaximum(1)
                .create())
        .withDescription("where to get training data").create();

    Option outputFile = builder
        .withLongName("output")
        .withRequired(true)
        .withArgument(
            argumentBuilder.withName("output").withMaximum(1)
                .create())
        .withDescription("where to write the model content").create();

    Option threads = builder.withLongName("threads")
        .withArgument(
            argumentBuilder.withName("threads").withDefault("4").create())
        .withDescription("the number of threads AdaptiveLogisticRegression uses")
        .create();

    Option predictors = builder.withLongName("predictors")
        .withRequired(true)
        .withArgument(argumentBuilder.withName("predictors").create())
        .withDescription("a list of predictor variables").create();

    Option types = builder
        .withLongName("types")
        .withRequired(true)
        .withArgument(argumentBuilder.withName("types").create())
        .withDescription(
            "a list of predictor variable types (numeric, word, or text)")
        .create();

    Option target = builder
        .withLongName("target")
        .withDescription("the name of the target variable")
        .withRequired(true)
        .withArgument(
            argumentBuilder.withName("target").withMaximum(1)
                .create())
         .create();

    Option targetCategories = builder
    .withLongName("categories")
    .withDescription("the number of target categories to be considered")
    .withRequired(true)
    .withArgument(
        argumentBuilder.withName("categories").withMaximum(1)
            .create())
    .create();

    Option features = builder
        .withLongName("features")
        .withDescription("the number of internal hashed features to use")
        .withArgument(
            argumentBuilder.withName("numFeatures")
                .withDefault("1000").withMaximum(1).create())
        .create();

    Option passes = builder
        .withLongName("passes")
        .withDescription("the number of times to pass over the input data")
        .withArgument(
            argumentBuilder.withName("passes").withDefault("2")
                .withMaximum(1).create())
        .create();

    Option interval = builder.withLongName("interval")
        .withArgument(
            argumentBuilder.withName("interval").withDefault("500").create())
        .withDescription("the interval property of AdaptiveLogisticRegression")
        .create();

    Option window = builder.withLongName("window")
        .withArgument(
            argumentBuilder.withName("window").withDefault("800").create())
        .withDescription("the average propery of AdaptiveLogisticRegression")
        .create();

    Option skipperfnum = builder.withLongName("skipperfnum")
        .withArgument(
            argumentBuilder.withName("skipperfnum").withDefault("99").create())
        .withDescription("show performance measures every (skipperfnum + 1) rows")
        .create();

    Option prior = builder.withLongName("prior")
        .withArgument(
            argumentBuilder.withName("prior").withDefault("L1").create())
        .withDescription("the prior algorithm to use: L1, L2, ebp, tp, up")
        .create();

    Option priorOption = builder.withLongName("prioroption")
        .withArgument(
            argumentBuilder.withName("prioroption").create())
        .withDescription("constructor parameter for ElasticBandPrior and TPrior")
        .create();

    Option auc = builder.withLongName("auc")
        .withArgument(
            argumentBuilder.withName("auc").withDefault("global").create())
        .withDescription("the auc to use: global or grouped")
        .create();

    Group normalArgs = new GroupBuilder().withOption(help)
        .withOption(quiet).withOption(inputFile).withOption(outputFile)
        .withOption(target).withOption(targetCategories)
        .withOption(predictors).withOption(types).withOption(passes)
        .withOption(interval).withOption(window).withOption(threads)
        .withOption(prior).withOption(features).withOption(showperf)
        .withOption(skipperfnum).withOption(priorOption).withOption(auc)
        .create();

    Parser parser = new Parser();
    parser.setHelpOption(help);
    parser.setHelpTrigger("--help");
    parser.setGroup(normalArgs);
    parser.setHelpFormatter(new HelpFormatter(" ", "", " ", 130));
    CommandLine cmdLine = parser.parseAndHelp(args);

    if (cmdLine == null) {
      return false;
    }

    TrainAdaptiveLogistic.inputFile = getStringArgument(cmdLine, inputFile);
    TrainAdaptiveLogistic.outputFile = getStringArgument(cmdLine,
                                                         outputFile);

    List<String> typeList = Lists.newArrayList();
    for (Object x : cmdLine.getValues(types)) {
      typeList.add(x.toString());
    }

    List<String> predictorList = Lists.newArrayList();
    for (Object x : cmdLine.getValues(predictors)) {
      predictorList.add(x.toString());
    }

    lmp = new AdaptiveLogisticModelParameters();
    lmp.setTargetVariable(getStringArgument(cmdLine, target));
    lmp.setMaxTargetCategories(getIntegerArgument(cmdLine, targetCategories));
    lmp.setNumFeatures(getIntegerArgument(cmdLine, features));
    lmp.setInterval(getIntegerArgument(cmdLine, interval));
    lmp.setAverageWindow(getIntegerArgument(cmdLine, window));
    lmp.setThreads(getIntegerArgument(cmdLine, threads));
    lmp.setAuc(getStringArgument(cmdLine, auc));
    lmp.setPrior(getStringArgument(cmdLine, prior));
    if (cmdLine.getValue(priorOption) != null) {
      lmp.setPriorOption(getDoubleArgument(cmdLine, priorOption));
    }
    lmp.setTypeMap(predictorList, typeList);
    TrainAdaptiveLogistic.showperf = getBooleanArgument(cmdLine, showperf);
    TrainAdaptiveLogistic.skipperfnum = getIntegerArgument(cmdLine, skipperfnum);
    TrainAdaptiveLogistic.passes = getIntegerArgument(cmdLine, passes);

    lmp.checkParameters();

    return true;
  }

  private static String getStringArgument(CommandLine cmdLine,
                                          Option inputFile) {
    return (String) cmdLine.getValue(inputFile);
  }

  private static boolean getBooleanArgument(CommandLine cmdLine, Option option) {
    return cmdLine.hasOption(option);
  }

  private static int getIntegerArgument(CommandLine cmdLine, Option features) {
    return Integer.parseInt((String) cmdLine.getValue(features));
  }

  private static double getDoubleArgument(CommandLine cmdLine, Option op) {
    return Double.parseDouble((String) cmdLine.getValue(op));
  }

  public static AdaptiveLogisticRegression getModel() {
    return model;
  }

  public static LogisticModelParameters getParameters() {
    return lmp;
  }

   static BufferedReader open(String inputFile) throws IOException {
    InputStream in;
    try {
      in = Resources.getResource(inputFile).openStream();
    } catch (IllegalArgumentException e) {
      in = new FileInputStream(new File(inputFile));
    }
    return new BufferedReader(new InputStreamReader(in, Charsets.UTF_8));
  }

}


text:
function hideElementById(id) {
	document.getElementById(id).style.display = "none";
}

function showElementById(id) {
	document.getElementById(id).style.display = "block";
}

function addClassName(node, className) {
    if(node.classList) {
        node.classList.add(className);
    } else {
        var classNameList = node.className.split(" ");
        classNameList.push(className);
        node.className = classNameList.join(" ");
    }
}

function getEventTarget(event) {
    return event.target || event.srcElement;
}
function addEvent(node, type, callback) {
    if (window.attachEvent) { // IE
        node.attachEvent("on" + type, callback);
    } else if (window.addEventListener) {
        node.addEventListener( type, callback, false);
    } else {
        alert("无法绑定事件,请反馈给管理员");
    }
    return node;
}
function delegate(node, childNodeSelector, eventType, func) {
    addEvent(node, eventType, function(event) {
        var target = getEventTarget(event);
        if(isSelector(target, childNodeSelector)) {
            func(event);
        }
    })
}

function getChildNodes(node, selector) {
    var childNodes = node.childNodes,
        len = childNodes.length,
        result = Array(),
        nodeType = 1; // nodetype of tag is 1, text's is 3
    if(!selector) {
        // all tags
        result = getAllChildNodes(node);
    } else if(isClassSelector(selector)) {
        // tags with class
        var temp = splitSelector(selector),
            tagName = temp["tagName"],
            className = temp["className"];
        result = getChildNodesByClassName(node, className, tagName);
    } else {
        result = getChildNodesByTagName(node, selector);
    }
    return result;
}
function getAllChildNodes(node) {
    var childNodes = node.childNodes;
    var len = childNodes.length,
        result = Array(),
        nodeType = 1; // nodetype of tag is 1, text's is 3
    for (var i = 0; i < len; i++) {
        if(childNodes[i].nodeType == nodeType) {
            result.push(childNodes[i]);
        }
    }
    return result;
}
function getChildNodesByTagName(node, tagName) {
    var childNodes = getAllChildNodes(node),
        result = Array();
    for(var i = 0, len = childNodes.length; i < len; i++) {
        if(isSelector(childNodes[i], tagName)) {
            result.push(childNodes[i]);
        }
    }
    return result;
}
function getChildNodesByClassName(node, className, tagName) {
    var childNodes = Array(),
        result = Array();
    if(!tagName) {
        childNodes = getAllChildNodes(node);
    } else {
        childNodes = getChildNodesByTagName(node, tagName);
    }
    for(var i = 0, len = childNodes.length; i < len; i++) {
        if(hasClass(childNodes[i], className)) {
            result.push(childNodes[i]);
        }
    }
    return result;
}

function hasClass(node, className) {
    if(node.classList) {
        return node.classList.contains(className);
    } else {
        var classList = node.className.split(" ");
        for(var i = 0, len = classList.length; i < len; i++) {
            if(classList[i] === className) {
                return true;
            }
        }
        return false;
    }
}

function isClassSelector(selector) {
    return selector.indexOf(".") > -1;
}
function isIdSelector(selector) {
    return selector.indexOf("#") > -1;
}
function splitSelector(selector) {
    if(isClassSelector(selector)) {
        var arr = selector.split(".");
        return {
            "tagName": arr[0],
            "className": arr[1]
        };
    } else if(isIdSelector(selector)) {
        var arr = selector.split("#");
        return {
            "tagName": arr[0],
            "id": arr[1]
        };
    } else {
        return selector;
    }
}

function each(nodeArr, func) {
    if(!(nodeArr instanceof Array)) {
        return;
    }
    for(var i = 0, len = nodeArr.length; i < len; i++) {
        func.call(nodeArr[i]);
    }
}

function getWidth(node) {
    var width = getStyle(node, "width");
    if(width === "auto") {
        width = node.offsetWidth;
    }
    return parseInt(width);
}

function getStyle(node, styleName) {
    var computedStyle = null;
    if(node.currentStyle) {
        computedStyle = node.currentStyle;
    } else {
        computedStyle = window.getComputedStyle(node, null);
    }
    return computedStyle[styleName];
}

function setStyle(node, styleName, styleValue) {
    var pxArr = ["width", "height", "lineHeight", "left", "top", "padding", "paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "fontSize"];
    var unit = inArray(pxArr, styleName) ? "px" : "";
    node.style[styleName] = styleValue + unit;
}

function inArray(arr, value) {
    if(!(arr instanceof Array) || !arr || !value) {
        return false;
    }
    for(var i = 0, len = arr.length; i < len; i++) {
        if(arr[i] === value) {
            return true;
        }
    }
    return false;
}

function closestNode(node, selector) {
    var currentNode = node;
    while(currentNode != document) {
        if(isSelector(currentNode, selector)) {
            return currentNode;
        }
        currentNode = currentNode.parentNode;
    }
    return null;
}

function isSelector(node, selector) {
    if(isClassSelector(selector)) {
        var className = splitSelector(selector)["className"];
        return hasClass(node, className);
    } else if(isIdSelector(selector)) {
        var id = splitSelector(selector)["id"];
        return node.id === id;
    } else {
        return node.tagName.toLowerCase() === selector.toLowerCase();
    }
}

function preventDefault(event) {
    if(document.all) {
        window.event.returnValue = false;
    } else {
        event.preventDefault();
    }
}


text:
import * as VsCodeTypes from 'vscode';

// imports
import { PackageResponse, ReplaceVersionFunction } from 'core/packages';
import { VersionLens } from './versionLens';

export function createFromPackageResponses(
  document: VsCodeTypes.TextDocument,
  responses: Array<PackageResponse>,
  replaceVersionFn: ReplaceVersionFunction,
): Array<VersionLens> {
  return responses.map(
    function (response) {
      return createFromPackageResponse(
        response,
        document,
        replaceVersionFn
      );
    }
  );
}

function createFromPackageResponse(
  packageResponse: PackageResponse,
  document: VsCodeTypes.TextDocument,
  replaceVersionFn: ReplaceVersionFunction,
): VersionLens {
  const { Uri, Range } = require('vscode')

  const { nameRange, versionRange } = packageResponse;
  const commandRangePos = nameRange.start + packageResponse.order;
  const commandRange = new Range(
    document.positionAt(commandRangePos),
    document.positionAt(commandRangePos)
  );
  const replaceRange = new Range(
    document.positionAt(versionRange.start),
    document.positionAt(versionRange.end)
  );
  return new VersionLens(
    commandRange,
    replaceRange,
    packageResponse,
    Uri.file(document.fileName),
    replaceVersionFn
  );
}


text:
Font Mfizz by Fizzed
=======================================

 - [Fizzed, Inc.](http://fizzed.com) (Follow on Twitter: [@fizzed_inc](http://twitter.com/fizzed_inc))

## Vector Icons for Technology and Software Geeks

Font Mfizz provides scalable vector icons representing programming languages,
operating systems, software engineering, and technology. It was designed designed
for technology and software geeks. It can be customized — size, color, drop shadow,
and anything that can be done with the power of CSS.

[View icons in action and usage information](http://fizzed.com/oss/font-mfizz)

Designed by [Fizzed, Inc.](http://fizzed.com/)

Updates tweeted [@fizzed_inc](http://twitter.com/fizzed_inc)

## Releases

[Download packages](https://github.com/fizzed/font-mfizz/releases)

## CDN

[cdnjs](https://cdnjs.com) now hosts font-mfizz for use by all. Visit [https://cdnjs.com/libraries/font-mfizz](https://cdnjs.com/libraries/font-mfizz) for more info.

## Development

Building font-mfizz relies on many system-level dependencies.  Rather than you
trying to setup the environment yourself, we have switched to using
[Vagrant](https://www.vagrantup.com/) to help automate the setup of a development environment.
What's great is that even if you're on Linux, Windows, or Mac, you'll get the exact
environment the font-mfizz maintainers use to build the font.

 * Install [Vagrant](https://www.vagrantup.com/)
 * Run `vagrant up`
 * Sit back, get a coffee...
 * Run `vagrant ssh`
 * You're now ssh'ed into your font-mfizz virtual dev machine
 * `cd /vagrant`
 * `java -jar blaze.jar`
 * On your actual real machine, open up `build/font/preview.html` in your browser

## Can I add an icon?

Short answer, yes!

Since this font is a hobby, the fastest way to get a new one added is to add it
yourself.  We're happy to accept pull requests and periodically publish new builds.
Here are the steps to get an icon officially added:

1. Does the icon fit within the theme of this font?  Does it represent a programming language,
operating system, or software engineering?

2. Find (or create) a .svg (Scalable Vector Graphics) version of the icon you'd like to add.
Please note that you may need to tweak and simplify your .svg file for it to be properly
converted into a web font.

3. Add your .svg file to `src/svg`. The file name will become the eventual glyph name (e.g. java.svg
becomes .icon-java in the css).

4. Follow the steps above to setup your development environment.  Compile the font with your
   new icon(s).  Verify they look good in a browser.  Sometimes they need tweaking.

5. Submit a pull request.

## License

This project is licensed under the MIT License and © 2013-2016 Fizzed, Inc. You can find a copy of
all of the licenses in the projects LICENSE.txt file.

All icons representing commercial companies are trademarks of their respective owners. The use of
these trademarks does not indicate endorsement of the trademark holder by Fizzed, Font Mfizz, nor
vice versa.


text:
define([
	'jquery',
	'underscore',
	'backbone',
	'scripts/config',
	'scripts/registry',
	'scripts/models/packages/package',
	'scripts/collections/utilities/named-items'
], function($, _, Backbone, Config, Registry, Package, NamedItems) {
	return NamedItems.extend({

		//
		// Backbone attributes
		//

		model: Package,
		url: Config.csaServer + '/packages/public',

		//
		// filtering methods
		//

		getPublic: function() {
			return this.getByAttribute('package_sharing_status', 'public');
		},

		getPrivate: function() {
			return this.getByAttribute('package_sharing_status', 'private');
		},

		getProtected: function() {
			return this.getByAttribute('package_sharing_status', 'protected');
		},

		getNonPublic: function() {
			return this.getByNotAttribute('package_sharing_status', 'public');
		},

		getPlatformDependent: function() {
			var collection = this.clone();

			collection.reset();
			this.each(function(item) {
				if (!item.isPlatformIndependent()) {
					collection.add(item);
				}
			});

			return collection;
		},

		getPlatformIndependent: function() {
			var collection = this.clone();

			collection.reset();
			this.each(function(item) {
				if (item.isPlatformIndependent()) {
					collection.add(item);
				}
			});

			return collection;
		},

		//
		// ajax methods
		//

		fetch: function(options) {
			return this.fetchByUser(Registry.application.session.user, options);
		},

		fetchTypes: function(options) {
			return NamedItems.prototype.fetch.call(this, _.extend(options, {
				url: Config.csaServer + '/packages/types'
			}));
		},

		fetchByUser: function(user, options) {
			return NamedItems.prototype.fetch.call(this, _.extend(options, {
				url: Config.csaServer + '/packages/users/' + user.get('user_uid')
			}));
		},

		fetchAll: function(options) {
			return NamedItems.prototype.fetch.call(this, _.extend(options, {
				url: Config.csaServer + '/packages/all/'
			}));
		},

		fetchPublic: function(options) {
			return NamedItems.prototype.fetch.call(this, _.extend(options, {
				url: Config.csaServer + '/packages/public'
			}));
		},

		fetchProtected: function(project, options) {
			return NamedItems.prototype.fetch.call(this, _.extend(options, {
				url: Config.csaServer + '/packages/protected/' + project.get('project_uid')
			}));
		},

		fetchAllProtected: function(projects, options) {
			return NamedItems.prototype.fetch.call(this, _.extend(options, {
				url: Config.csaServer + '/packages/protected/' + projects.getUuidsStr()
			}));
		},

		fetchAvailableToMe: function(options) {
			return NamedItems.prototype.fetch.call(this, _.extend(options, {
				url: Config.csaServer + '/packages/available'
			}));
		},

		fetchByProject: function(project, options) {
			return NamedItems.prototype.fetch.call(this, _.extend(options, {
				url: Config.csaServer + '/packages/projects/' + project.get('project_uid')
			}));
		}
	}, {

		//
		// static methods
		//

		fetchNumByUser: function(user, options) {
			return $.ajax(Config.csaServer + '/packages/users/' + user.get('user_uid') + '/num', options);
		},

		fetchNumProtected: function(project, options) {
			return $.ajax(Config.csaServer + '/packages/protected/' + project.get('project_uid') + '/num', options);
		},

		fetchNumAllProtected: function(projects, options) {
			return $.ajax(Config.csaServer + '/packages/protected/' + projects.getUuidsStr() + '/num', options);
		},
	});
});


text:
import computeFn from '../utils/helper-compute';
import BaseHelper from './-base';

export default BaseHelper.extend({
  compute: computeFn(function (params, { hideAffix, locale, timeZone }) {
    this._super(...arguments);

    const moment = this.moment;
    return this.morphMoment(moment.moment(...params), {
      locale,
      timeZone,
    }).fromNow(hideAffix);
  }),
});


text:
///////////////////////////////////////////////////////////////////////////////
//
// File ExpList3D.cpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Expansion list 3D definition
//
///////////////////////////////////////////////////////////////////////////////

#include <iomanip>
#include <MultiRegions/ExpList3D.h>

#include <LocalRegions/HexExp.h>
#include <LocalRegions/PrismExp.h>
#include <LocalRegions/PyrExp.h>
#include <LocalRegions/TetExp.h>

#include <LibUtilities/Foundations/Interp.h>
#include <LibUtilities/Foundations/PhysGalerkinProject.h>

namespace Nektar
{
    namespace MultiRegions
    {

        ExpList3D::ExpList3D(): ExpList()
        {
            SetExpType(e3D);
        }

        ExpList3D::ExpList3D(const ExpList3D &In): ExpList(In)
        {
            SetExpType(e3D);
        }

        ExpList3D::~ExpList3D()
        {
        }

        ExpList3D::ExpList3D(const LibUtilities::SessionReaderSharedPtr &pSession,
                             const LibUtilities::BasisKey &TBa,
                             const LibUtilities::BasisKey &TBb,
                             const LibUtilities::BasisKey &TBc,
                             const LibUtilities::BasisKey &HBa,
                             const LibUtilities::BasisKey &HBb,
                             const LibUtilities::BasisKey &HBc,
                             const SpatialDomains::MeshGraphSharedPtr &graph3D,
                             const LibUtilities::PointsType TetNb):
            ExpList(pSession,graph3D)
        {
            SetExpType(e3D);

            LocalRegions::TetExpSharedPtr tet;
            LocalRegions::HexExpSharedPtr hex;
            LocalRegions::PrismExpSharedPtr prism;
            LocalRegions::PyrExpSharedPtr pyramid;

            const SpatialDomains::ExpansionMap &expansions = graph3D->GetExpansions();

            SpatialDomains::ExpansionMap::const_iterator expIt;
            for (expIt = expansions.begin(); expIt != expansions.end(); ++expIt)
            {
                SpatialDomains::TetGeomSharedPtr TetGeom;
                SpatialDomains::HexGeomSharedPtr HexGeom;
                SpatialDomains::PrismGeomSharedPtr PrismGeom;
                SpatialDomains::PyrGeomSharedPtr PyrGeom;

                if((TetGeom = boost::dynamic_pointer_cast<SpatialDomains::TetGeom>(expIt->second->m_geomShPtr)))
                {
                    if(TetNb < LibUtilities::SIZE_PointsType)
                    {
//                         Ntet = MemoryManager<LocalRegions::NodalTetExp>::AllocateSharedPtr(TetBa,TetBb,TetBc,TetNb,TetGeom);
//                         (*m_exp).push_back(Ntet);
                    }
                    else
                    {
                        tet = MemoryManager<LocalRegions::TetExp>::AllocateSharedPtr(TBa,TBb,TBc,TetGeom);
                        (*m_exp).push_back(tet);
                    }

                    m_ncoeffs += LibUtilities::StdTetData::getNumberOfCoefficients(TBa.GetNumModes(), TBb.GetNumModes(), TBc.GetNumModes());

                    m_npoints += TBa.GetNumPoints()*TBb.GetNumPoints()*TBc.GetNumPoints();
                }
/*
                else if((PrismGeom = boost::dynamic_pointer_cast<SpatialDomains::PrismGeom>(expansions[i]->m_geomShPtr)))
                {
                      prism = MemoryManager<LocalRegions::PrismExp>::AllocateSharedPtr(Ba,Bb,Bc,PrismGeom);
                      (*m_exp).push_back(prism);

                      m_ncoeffs += StdRegions::StdPrismData::getNumberOfCoefficients(Ba.GetNumModes(), Bb.GetNumModes(), Bc.GetNumModes());
                      m_npoints +=  Ba.GetNumPoints()*Bb.GetNumPoints()*Bc.GetNumPoints();

                }
                else if((PyrGeom = boost::dynamic_pointer_cast<SpatialDomains::PyrGeom>(expansions[i]->m_geomShPtr)))
                {
                     pyramid = MemoryManager<LocalRegions::PyrExp>::AllocateSharedPtr(Ba,Bb,Bc,PyrGeom);
                     (*m_exp).push_back(pyramid);

                     m_ncoeffs += StdRegions::StdPyrData::getNumberOfCoefficients(Ba.GetNumModes(), Bb.GetNumModes(), Bc.GetNumModes());
                      m_npoints +=  Ba.GetNumPoints()*Bb.GetNumPoints()*Bc.GetNumPoints();

                }
*/
                else if((HexGeom = boost::dynamic_pointer_cast<SpatialDomains::HexGeom>(expIt->second->m_geomShPtr)))
                {
                    hex = MemoryManager<LocalRegions::HexExp>::AllocateSharedPtr(HBa,HBb,HBc, HexGeom);
                    (*m_exp).push_back(hex);

                    m_ncoeffs += HBa.GetNumModes()*HBb.GetNumModes()*HBc.GetNumModes();
                    m_npoints += HBa.GetNumPoints()*HBb.GetNumPoints()*HBc.GetNumPoints();
                }
                else
                {
                    ASSERTL0(false,"dynamic cast to a proper Geometry3D failed");
                }

            }

            // Setup Default optimisation information.
            int nel = GetExpSize();
            m_globalOptParam = MemoryManager<NekOptimize::GlobalOptParam>
                ::AllocateSharedPtr(nel);

            SetCoeffPhys();

            ReadGlobalOptimizationParameters();
            CreateCollections();
        }

        /**
         * Given a mesh \a graph3D, containing information about the domain and
         * the spectral/hp element expansion, this constructor fills the list
         * of local expansions \texttt{m_exp} with the proper expansions,
         * calculates the total number of quadrature points
         * \f$\boldsymbol{x}_i\f$ and the local expansion coefficients
         * \f$\hat{u}^e_n\f$ and allocates memory for the arrays #m_coeffs and
         * #m_phys.
         *
         * @param   graph3D     A mesh, containing information about the domain
         *                      and the spectral/hp element expansion.
         */
        ExpList3D::ExpList3D(const LibUtilities::SessionReaderSharedPtr &pSession,
                             const SpatialDomains::MeshGraphSharedPtr &graph3D,
                             const std::string  &variable) :
            ExpList(pSession,graph3D)
        {
            SetExpType(e3D);

            int elmtid = 0;
            LocalRegions::TetExpSharedPtr   tet;
            LocalRegions::HexExpSharedPtr   hex;
            LocalRegions::PrismExpSharedPtr prism;
            LocalRegions::PyrExpSharedPtr   pyramid;

            const SpatialDomains::ExpansionMap &expansions
                                        = graph3D->GetExpansions(variable);

            SpatialDomains::ExpansionMap::const_iterator expIt;
            for (expIt = expansions.begin(); expIt != expansions.end(); ++expIt)
            {
                SpatialDomains::TetGeomSharedPtr   TetGeom;
                SpatialDomains::HexGeomSharedPtr   HexGeom;
                SpatialDomains::PrismGeomSharedPtr PrismGeom;
                SpatialDomains::PyrGeomSharedPtr   PyrGeom;

                if((TetGeom = boost::dynamic_pointer_cast<
                        SpatialDomains::TetGeom>(expIt->second->m_geomShPtr)))
                {
                    LibUtilities::BasisKey TetBa
                                        = expIt->second->m_basisKeyVector[0];
                    LibUtilities::BasisKey TetBb
                                        = expIt->second->m_basisKeyVector[1];
                    LibUtilities::BasisKey TetBc
                                        = expIt->second->m_basisKeyVector[2];

                    if(TetBa.GetBasisType() == LibUtilities::eGLL_Lagrange ||
                       TetBa.GetBasisType() == LibUtilities::eGauss_Lagrange)
                    {
                      ASSERTL0(false,"LocalRegions::NodalTetExp is not "
                                     "implemented yet");
                    }
                    else
                    {
                        tet = MemoryManager<LocalRegions::TetExp>
                                        ::AllocateSharedPtr(TetBa,TetBb,TetBc,
                                                            TetGeom);
                        tet->SetElmtId(elmtid++);
                        (*m_exp).push_back(tet);
                    }
                }
                else if((PrismGeom = boost::dynamic_pointer_cast<SpatialDomains
                             ::PrismGeom>(expIt->second->m_geomShPtr)))
                {
                    LibUtilities::BasisKey PrismBa
                                        = expIt->second->m_basisKeyVector[0];
                    LibUtilities::BasisKey PrismBb
                                        = expIt->second->m_basisKeyVector[1];
                    LibUtilities::BasisKey PrismBc
                                        = expIt->second->m_basisKeyVector[2];

                    prism = MemoryManager<LocalRegions::PrismExp>
                                        ::AllocateSharedPtr(PrismBa,PrismBb,
                                                            PrismBc,PrismGeom);
                    prism->SetElmtId(elmtid++);
                    (*m_exp).push_back(prism);
                }
                else if((PyrGeom = boost::dynamic_pointer_cast<
                         SpatialDomains::PyrGeom>(expIt->second->m_geomShPtr)))
                {
                    LibUtilities::BasisKey PyrBa
                                        = expIt->second->m_basisKeyVector[0];
                    LibUtilities::BasisKey PyrBb
                                        = expIt->second->m_basisKeyVector[1];
                    LibUtilities::BasisKey PyrBc
                                        = expIt->second->m_basisKeyVector[2];

                    pyramid = MemoryManager<LocalRegions::PyrExp>
                                        ::AllocateSharedPtr(PyrBa,PyrBb,PyrBc,
                                                            PyrGeom);
                    pyramid->SetElmtId(elmtid++);
                    (*m_exp).push_back(pyramid);
                }
                else if((HexGeom = boost::dynamic_pointer_cast<
                         SpatialDomains::HexGeom>(expIt->second->m_geomShPtr)))
                {
                    LibUtilities::BasisKey HexBa
                                        = expIt->second->m_basisKeyVector[0];
                    LibUtilities::BasisKey HexBb
                                        = expIt->second->m_basisKeyVector[1];
                    LibUtilities::BasisKey HexBc
                                        = expIt->second->m_basisKeyVector[2];

                    hex = MemoryManager<LocalRegions::HexExp>
                                        ::AllocateSharedPtr(HexBa,HexBb,HexBc,
                                                            HexGeom);
                    hex->SetElmtId(elmtid++);
                    (*m_exp).push_back(hex);
                }
                else
                {
                    ASSERTL0(false,"dynamic cast to a proper Geometry3D "
                                   "failed");
                }

            }

            // Setup Default optimisation information.
            int nel = GetExpSize();
            m_globalOptParam = MemoryManager<NekOptimize::GlobalOptParam>
                ::AllocateSharedPtr(nel);

            SetCoeffPhys();
            ReadGlobalOptimizationParameters();
            CreateCollections();
        }

        /**
         * Given an expansion vector \a expansions, containing
         * information about the domain and the spectral/hp element
         * expansion, this constructor fills the list of local
         * expansions \texttt{m_exp} with the proper expansions,
         * calculates the total number of quadrature points
         * \f$\boldsymbol{x}_i\f$ and the local expansion coefficients
         * \f$\hat{u}^e_n\f$ and allocates memory for the arrays
         * #m_coeffs and #m_phys.
         *
         * @param expansions An expansion vector, containing
         *                   information about the domain and the
         *                   spectral/hp element expansion.
         */
        ExpList3D::ExpList3D(const SpatialDomains::ExpansionMap &expansions):
            ExpList()
        {
            SetExpType(e3D);

            int elmtid = 0;
            LocalRegions::TetExpSharedPtr tet;
            LocalRegions::HexExpSharedPtr hex;
            LocalRegions::PrismExpSharedPtr prism;
            LocalRegions::PyrExpSharedPtr pyramid;

            for(int i = 0; i < expansions.size(); ++i)
            {
                SpatialDomains::TetGeomSharedPtr TetGeom;
                SpatialDomains::HexGeomSharedPtr HexGeom;
                SpatialDomains::PrismGeomSharedPtr PrismGeom;
                SpatialDomains::PyrGeomSharedPtr PyrGeom;

                SpatialDomains::ExpansionMap::const_iterator expmap = expansions.find(i);
                ASSERTL1(expmap != expansions.end(), "Unable to find expansion.");
                const SpatialDomains::ExpansionShPtr exp = expmap->second;

                if((TetGeom = boost::dynamic_pointer_cast<
                        SpatialDomains::TetGeom>(exp->m_geomShPtr)))
                {
                    LibUtilities::BasisKey TetBa
                                        = exp->m_basisKeyVector[0];
                    LibUtilities::BasisKey TetBb
                                        = exp->m_basisKeyVector[1];
                    LibUtilities::BasisKey TetBc
                                        = exp->m_basisKeyVector[2];

                    if(TetBa.GetBasisType() == LibUtilities::eGLL_Lagrange ||
                       TetBa.GetBasisType() == LibUtilities::eGauss_Lagrange)
                    {
                      ASSERTL0(false,"LocalRegions::NodalTetExp is not "
                                     "implemented yet");
                    }
                    else
                    {
                        tet = MemoryManager<LocalRegions::TetExp>
                                        ::AllocateSharedPtr(TetBa,TetBb,TetBc,
                                                            TetGeom);
                        tet->SetElmtId(elmtid++);
                        (*m_exp).push_back(tet);
                    }
                }
                else if((PrismGeom = boost::dynamic_pointer_cast<
                         SpatialDomains::PrismGeom>(exp->m_geomShPtr)))
                {
                    LibUtilities::BasisKey PrismBa
                                        = exp->m_basisKeyVector[0];
                    LibUtilities::BasisKey PrismBb
                                        = exp->m_basisKeyVector[1];
                    LibUtilities::BasisKey PrismBc
                                        = exp->m_basisKeyVector[2];

                    prism = MemoryManager<LocalRegions::PrismExp>
                                        ::AllocateSharedPtr(PrismBa,PrismBb,
                                                            PrismBc,PrismGeom);
                    prism->SetElmtId(elmtid++);
                    (*m_exp).push_back(prism);
                }
                else if((PyrGeom = boost::dynamic_pointer_cast<
                         SpatialDomains::PyrGeom>(exp->m_geomShPtr)))
                {
                    LibUtilities::BasisKey PyrBa
                                        = exp->m_basisKeyVector[0];
                    LibUtilities::BasisKey PyrBb
                                        = exp->m_basisKeyVector[1];
                    LibUtilities::BasisKey PyrBc
                                        = exp->m_basisKeyVector[2];

                    pyramid = MemoryManager<LocalRegions::PyrExp>
                                        ::AllocateSharedPtr(PyrBa,PyrBb,PyrBc,
                                                            PyrGeom);
                    pyramid->SetElmtId(elmtid++);
                    (*m_exp).push_back(pyramid);
                }
                else if((HexGeom = boost::dynamic_pointer_cast<
                         SpatialDomains::HexGeom>(exp->m_geomShPtr)))
                {
                    LibUtilities::BasisKey HexBa
                                        = exp->m_basisKeyVector[0];
                    LibUtilities::BasisKey HexBb
                                        = exp->m_basisKeyVector[1];
                    LibUtilities::BasisKey HexBc
                                        = exp->m_basisKeyVector[2];

                    hex = MemoryManager<LocalRegions::HexExp>
                                        ::AllocateSharedPtr(HexBa,HexBb,HexBc,
                                                            HexGeom);
                    hex->SetElmtId(elmtid++);
                    (*m_exp).push_back(hex);
                }
                else
                {
                    ASSERTL0(false,"dynamic cast to a proper Geometry3D "
                                   "failed");
                }

            }

            // Setup Default optimisation information.
            int nel = GetExpSize();
            m_globalOptParam = MemoryManager<NekOptimize::GlobalOptParam>
                ::AllocateSharedPtr(nel);

            SetCoeffPhys();
            CreateCollections();
        }

        /**
         * Set up the storage for the concatenated list of
         * coefficients and physical evaluations at the quadrature
         * points. Each expansion (local element) is processed in turn
         * to determine the number of coefficients and physical data
         * points it contributes to the domain. Three arrays,
         * #m_coeff_offset, #m_phys_offset and #m_offset_elmt_id, are
         * also initialised and updated to store the data offsets of
         * each element in the #m_coeffs and #m_phys arrays, and the
         * element id that each consecutive block is associated
         * respectively.
         */
        void ExpList3D::SetCoeffPhys()
        {
            int i;

            // Set up offset information and array sizes
            m_coeff_offset   = Array<OneD,int>(m_exp->size());
            m_phys_offset    = Array<OneD,int>(m_exp->size());
            m_offset_elmt_id = Array<OneD,int>(m_exp->size());

            m_ncoeffs = m_npoints = 0;

            for(i = 0; i < m_exp->size(); ++i)
            {
                m_coeff_offset[i]   = m_ncoeffs;
                m_phys_offset [i]   = m_npoints;
                m_offset_elmt_id[i] = i;
                m_ncoeffs += (*m_exp)[i]->GetNcoeffs();
                m_npoints += (*m_exp)[i]->GetTotPoints();
            }

            m_coeffs = Array<OneD, NekDouble>(m_ncoeffs);
            m_phys   = Array<OneD, NekDouble>(m_npoints);
        }

        void ExpList3D::v_ReadGlobalOptimizationParameters()
        {
            Array<OneD, int> NumShape(4,0);

            for(int i = 0; i < GetExpSize(); ++i)
            {
                switch ((*m_exp)[i]->DetShapeType())
                {
                    case LibUtilities::eTetrahedron:  NumShape[0]++; break;
                    case LibUtilities::ePyramid:      NumShape[1]++; break;
                    case LibUtilities::ePrism:        NumShape[2]++; break;
                    case LibUtilities::eHexahedron:   NumShape[3]++; break;
                    default:
                        ASSERTL0(false, "Unknown expansion type.");
                        break;
                }
            }

            int three = 3;
            m_globalOptParam = MemoryManager<NekOptimize::GlobalOptParam>
                ::AllocateSharedPtr(m_session,three,NumShape);
        }

        void ExpList3D::v_WriteVtkPieceHeader(std::ostream &outfile, int expansion, int istrip)
        {
            int i,j,k;
            int nquad0 = (*m_exp)[expansion]->GetNumPoints(0);
            int nquad1 = (*m_exp)[expansion]->GetNumPoints(1);
            int nquad2 = (*m_exp)[expansion]->GetNumPoints(2);
            int ntot = nquad0*nquad1*nquad2;
            int ntotminus = (nquad0-1)*(nquad1-1)*(nquad2-1);

            Array<OneD,NekDouble> coords[3];
            coords[0] = Array<OneD,NekDouble>(ntot);
            coords[1] = Array<OneD,NekDouble>(ntot);
            coords[2] = Array<OneD,NekDouble>(ntot);
            (*m_exp)[expansion]->GetCoords(coords[0],coords[1],coords[2]);

            outfile << "    <Piece NumberOfPoints=\""
                    << ntot << "\" NumberOfCells=\""
                    << ntotminus << "\">" << endl;
            outfile << "      <Points>" << endl;
            outfile << "        <DataArray type=\"Float64\" "
                    << "NumberOfComponents=\"3\" format=\"ascii\">" << endl;
            outfile << "          ";
            for (i = 0; i < ntot; ++i)
            {
                for (j = 0; j < 3; ++j)
                {
                    outfile << setprecision(8) << scientific
                            << (float)coords[j][i] << " ";
                }
                outfile << endl;
            }

            outfile << endl;
            outfile << "        </DataArray>" << endl;
            outfile << "      </Points>" << endl;
            outfile << "      <Cells>" << endl;
            outfile << "        <DataArray type=\"Int32\" "
                    << "Name=\"connectivity\" format=\"ascii\">" << endl;
            for (i = 0; i < nquad0-1; ++i)
            {
                for (j = 0; j < nquad1-1; ++j)
                {
                    for (k = 0; k < nquad2-1; ++k)
                    {
                        outfile << k*nquad0*nquad1 + j*nquad0 + i << " "
                                << k*nquad0*nquad1 + j*nquad0 + i + 1 << " "
                                << k*nquad0*nquad1 + (j+1)*nquad0 + i + 1 << " "
                                << k*nquad0*nquad1 + (j+1)*nquad0 + i << " "
                                << (k+1)*nquad0*nquad1 + j*nquad0 + i << " "
                                << (k+1)*nquad0*nquad1 + j*nquad0 + i + 1 << " "
                                << (k+1)*nquad0*nquad1 + (j+1)*nquad0 + i + 1 << " "
                                << (k+1)*nquad0*nquad1 + (j+1)*nquad0 + i << " " << endl;
                    }
                }
            }
            outfile << endl;
            outfile << "        </DataArray>" << endl;
            outfile << "        <DataArray type=\"Int32\" "
                    << "Name=\"offsets\" format=\"ascii\">" << endl;
            for (i = 0; i < ntotminus; ++i)
            {
                outfile << i*8+8 << " ";
            }
            outfile << endl;
            outfile << "        </DataArray>" << endl;
            outfile << "        <DataArray type=\"UInt8\" "
                    << "Name=\"types\" format=\"ascii\">" << endl;
            for (i = 0; i < ntotminus; ++i)
            {
                outfile << "12 ";
            }
            outfile << endl;
            outfile << "        </DataArray>" << endl;
            outfile << "      </Cells>" << endl;
            outfile << "      <PointData>" << endl;
        }

        void ExpList3D::v_SetUpPhysNormals()
        {
            int i, j;
            for (i = 0; i < m_exp->size(); ++i)
            {
                for (j = 0; j < (*m_exp)[i]->GetNfaces(); ++j)
                {
                    (*m_exp)[i]->ComputeFaceNormal(j);
                }
            }
        }

        void ExpList3D::v_PhysInterp1DScaled(const NekDouble scale,
                                  const Array<OneD, NekDouble> &inarray,
                                  Array<OneD, NekDouble> &outarray)
        {
            int cnt,cnt1;

            cnt = cnt1 = 0;
            for(int i = 0; i < GetExpSize(); ++i)
            {
                // get new points key
                int pt0 = (*m_exp)[i]->GetNumPoints(0);
                int pt1 = (*m_exp)[i]->GetNumPoints(1);
                int pt2 = (*m_exp)[i]->GetNumPoints(2);
                int npt0 = (int) pt0*scale;
                int npt1 = (int) pt1*scale;
                int npt2 = (int) pt2*scale;

                LibUtilities::PointsKey newPointsKey0(npt0,(*m_exp)[i]->GetPointsType(0));
                LibUtilities::PointsKey newPointsKey1(npt1,(*m_exp)[i]->GetPointsType(1));
                LibUtilities::PointsKey newPointsKey2(npt2,(*m_exp)[i]->GetPointsType(2));

                // Interpolate points;
                LibUtilities::Interp3D((*m_exp)[i]->GetBasis(0)->GetPointsKey(),
                                       (*m_exp)[i]->GetBasis(1)->GetPointsKey(),
                                       (*m_exp)[i]->GetBasis(2)->GetPointsKey(),
                                       &inarray[cnt], newPointsKey0,
                                       newPointsKey1, newPointsKey2,
                                       &outarray[cnt1]);

                cnt  += pt0*pt1*pt2;
                cnt1 += npt0*npt1*npt2;
            }
        }

        void ExpList3D::v_PhysGalerkinProjection1DScaled(const NekDouble scale,
                                           const Array<OneD, NekDouble> &inarray,
                                           Array<OneD, NekDouble> &outarray)
        {
            int cnt,cnt1;

            cnt = cnt1 = 0;
            for(int i = 0; i < GetExpSize(); ++i)
            {
                // get new points key
                int pt0 = (*m_exp)[i]->GetNumPoints(0);
                int pt1 = (*m_exp)[i]->GetNumPoints(1);
                int pt2 = (*m_exp)[i]->GetNumPoints(2);
                int npt0 = (int) pt0*scale;
                int npt1 = (int) pt1*scale;
                int npt2 = (int) pt2*scale;

                LibUtilities::PointsKey newPointsKey0(npt0,(*m_exp)[i]->GetPointsType(0));
                LibUtilities::PointsKey newPointsKey1(npt1,(*m_exp)[i]->GetPointsType(1));
                LibUtilities::PointsKey newPointsKey2(npt2,(*m_exp)[i]->GetPointsType(2));

                // Project points;
                LibUtilities::PhysGalerkinProject3D(newPointsKey0,
                                                    newPointsKey1,
                                                    newPointsKey2,
                                                    &inarray[cnt],
                                       (*m_exp)[i]->GetBasis(0)->GetPointsKey(),
                                       (*m_exp)[i]->GetBasis(1)->GetPointsKey(),
                                       (*m_exp)[i]->GetBasis(2)->GetPointsKey(),
                                       &outarray[cnt1]);

                cnt  += npt0*npt1*npt2;
                cnt1 += pt0*pt1*pt2;
            }

        }
  } //end of namespace
} //end of namespace


text:
using System;

namespace libldt3
{
	namespace model
	{
		namespace enums
		{

			/// <summary>
			/// E024
			/// </summary>
			public enum AbrechnungsartPkv
			{

				/// Abrechnung Laborfacharzt
				AbrechnungLaborfacharzt,
				/// Abrechnung Privat-LG
				AbrechnungPrivatLG
			}

			public static class AbrechnungsartPkvExtensions
			{
				public static string GetCode(this AbrechnungsartPkv self)
				{
					switch (self)
					{
						case AbrechnungsartPkv.AbrechnungLaborfacharzt: return "1";
						case AbrechnungsartPkv.AbrechnungPrivatLG: return "2";
						default: throw new Exception();
					}
				}
			}
		}
	}
}


text:
<!doctype html><title>Minimal tQuery Page</title>
<script src="../../../build/tquery-bundle-require.js"></script>
<body><script>
require(['tquery.keyboard', 'tquery.minecraft'], function(){
	// create the world, add the boilerplate and start
	var world	= tQuery.createWorld().boilerplate().start();
	// create the minecraft character
	var character	= tQuery.createMinecraftChar().addTo(world);
	// simple hook
	world.hook(function(delta, now){
		var mesh	= character.object3D('root');
		mesh.rotateY(delta * Math.PI*2)
	});
});
</script></body>


text:
#include "TCPServerSocket.h"

#include <Poco/Net/SocketNotification.h>
#include <Poco/NObserver.h>

#include "TCPServerConnection.h"

namespace Titanium {

TCPServerSocketConnector::TCPServerSocketConnector(KMethodRef callback_, Poco::Net::ServerSocket& socket_, Poco::Net::SocketReactor & reactor_)
    : callback(callback_)
    , socket(socket_)
    , reactor(reactor_)
{
    reactor.addEventHandler(socket, Poco::Observer<TCPServerSocketConnector, Poco::Net::ReadableNotification>(*this, &TCPServerSocketConnector::onAccept));
}

TCPServerSocketConnector::~TCPServerSocketConnector()
{
    reactor.removeEventHandler(socket, Poco::Observer<TCPServerSocketConnector, Poco::Net::ReadableNotification>(*this, &TCPServerSocketConnector::onAccept));
}

void TCPServerSocketConnector::onAccept(Poco::Net::ReadableNotification *n)
{
    kroll::Logger *logger = kroll::Logger::Get("Network.TCPServerSocketConnector");

    n->release();
    Poco::Net::StreamSocket sock = socket.acceptConnection();
    AutoPtr<TCPServerConnection> conn = new TCPServerConnection(sock,reactor);

    ValueList args = ValueList();
    args.push_back(Value::NewObject(conn));
    try
    {
        RunOnMainThread(callback, args, false);
    }
    catch(ValueException& e)
    {
        SharedString ss = e.GetValue()->DisplayString();
        logger->Error("onAccept callback failed: %s", ss->c_str());
    }
}

TCPServerSocket::TCPServerSocket(KMethodRef create)
    : StaticBoundObject("Network.TCPServerSocket")
    , onCreate(create)
    , socket(0)
    , acceptor(0)
    , listenAdapter(new Poco::RunnableAdapter<TCPServerSocket>(
        *this, &TCPServerSocket::ListenThread))
    , listening(false)
{
    /**
     * @tiapi(method=True,name=Network.TCPServerSocket.listen,since=1.2)
     * @tiapi start listening for incoming connections
     * @tiarg[int, port] port to bind server socket
     */
    this->SetMethod("listen", &TCPServerSocket::Listen);

    /**
     * @tiapi(method=True,name=Network.TCPServerSocket.close,since=1.2)
     * @tiapi stop listening for incoming connections
     */
    this->SetMethod("close", &TCPServerSocket::Close);
}

TCPServerSocket::~TCPServerSocket()
{
    if (this->listening)
    {
        this->listening = false;
        this->reactor.stop();
        this->socket->close();
    }

    listenThread.join();
    delete listenAdapter;
}

void TCPServerSocket::ListenThread()
{
    this->acceptor = new TCPServerSocketConnector(this->onCreate,*this->socket,this->reactor);
    this->listening = true;

    while(this->listening)
    {
        this->reactor.run();
    }
}

void TCPServerSocket::Listen(const ValueList& args, KValueRef result)
{
    args.VerifyException("listen", "n");

    if (this->listening || listenThread.isRunning())
    {
        throw ValueException::FromString("Socket is already listening");
    }

    //TODO: add support for bind ipaddress

    int port = args.at(0)->ToInt();
    this->socket = new Poco::Net::ServerSocket(port);

    listenThread.start(*listenAdapter);
    result->SetBool(true);
}

void TCPServerSocket::Close(const ValueList& args, KValueRef result)
{
    if (this->listening)
    {
        this->listening = false;
        this->reactor.stop();
        this->socket->close();
        result->SetBool(true);
    }
    else
    {
        result->SetBool(false);
    }
}

} // namespace Titanium