text:
package org.apache.storm.zookeeper;

import java.util.HashMap;
import org.apache.zookeeper.Watcher;

public class ZkEventTypes {

    private static HashMap<Watcher.Event.EventType, String> map;

    static {
        map = new HashMap<Watcher.Event.EventType, String>();

        map.put(Watcher.Event.EventType.None, ":none");
        map.put(Watcher.Event.EventType.NodeCreated, ":node-created");
        map.put(Watcher.Event.EventType.NodeDeleted, ":node-deleted");
        map.put(Watcher.Event.EventType.NodeDataChanged, ":node-data-changed");
        map.put(Watcher.Event.EventType.NodeChildrenChanged, ":node-children-changed");

    }

    public static String getTypeName(Watcher.Event.EventType type) {
        return map.get(type);
    }

}


text:
<!doctype html>

	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>ServerDescription | mongodb</title>
	<meta name="description" content="Documentation for mongodb">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="../assets/css/main.css">

						Search
						<input id="tsd-search-field" type="text" />

Preparing search index...

The search index is not available

					mongodb

						Options

								All

Public

Public/Protected

All

							<input type="checkbox" id="tsd-filter-inherited" checked />
							Inherited
							<input type="checkbox" id="tsd-filter-externals" checked />
							Externals

					Menu

					mongodb

					ServerDescription

Class ServerDescription

The client's view of a single server, based on the most recent ismaster outcome.

Internal type, not meant to be directly instantiated

Hierarchy

						ServerDescription

Index

Constructors

constructor

Properties

$cluster<wbr>Time

_host<wbr>Address

address

arbiters

election<wbr>Id

error

hosts

last<wbr>Update<wbr>Time

last<wbr>Write<wbr>Date

logical<wbr>Session<wbr>Timeout<wbr>Minutes

max<wbr>Wire<wbr>Version

me

min<wbr>Wire<wbr>Version

passives

primary

round<wbr>Trip<wbr>Time

set<wbr>Name

set<wbr>Version

tags

topology<wbr>Version

type

Accessors

all<wbr>Hosts

host

host<wbr>Address

is<wbr>Data<wbr>Bearing

is<wbr>Readable

is<wbr>Writable

port

Methods

equals

Constructors

constructor

new <wbr>Server<wbr>Description(address: string | HostAddress, ismaster?: Document, options?: ServerDescriptionOptions): ServerDescription

Defined in src/sdam/server_description.ts:86

Create a ServerDescription

internal

Parameters

address: string | HostAddress

The address of the server

Optional ismaster: Document

An optional ismaster response for this server

Optional options: ServerDescriptionOptions

Returns ServerDescription

Properties

Optional $cluster<wbr>Time

$cluster<wbr>Time: ClusterTime

Defined in src/sdam/server_description.ts:77

Private _host<wbr>Address

_host<wbr>Address: HostAddress

Defined in src/sdam/server_description.ts:53

address

address: string

Defined in src/sdam/server_description.ts:54

arbiters

arbiters: string[]

Defined in src/sdam/server_description.ts:58

Optional election<wbr>Id

election<wbr>Id: ObjectId

Defined in src/sdam/server_description.ts:73

Optional error

error: MongoError

Defined in src/sdam/server_description.ts:61

hosts

hosts: string[]

Defined in src/sdam/server_description.ts:56

last<wbr>Update<wbr>Time

last<wbr>Update<wbr>Time: number

Defined in src/sdam/server_description.ts:66

last<wbr>Write<wbr>Date

last<wbr>Write<wbr>Date: number

Defined in src/sdam/server_description.ts:67

Optional logical<wbr>Session<wbr>Timeout<wbr>Minutes

logical<wbr>Session<wbr>Timeout<wbr>Minutes: number

Defined in src/sdam/server_description.ts:74

max<wbr>Wire<wbr>Version

max<wbr>Wire<wbr>Version: number

Defined in src/sdam/server_description.ts:64

Optional me

me: string

Defined in src/sdam/server_description.ts:69

min<wbr>Wire<wbr>Version

min<wbr>Wire<wbr>Version: number

Defined in src/sdam/server_description.ts:63

passives

passives: string[]

Defined in src/sdam/server_description.ts:57

Optional primary

primary: string

Defined in src/sdam/server_description.ts:70

round<wbr>Trip<wbr>Time

round<wbr>Trip<wbr>Time: number

Defined in src/sdam/server_description.ts:65

Optional set<wbr>Name

set<wbr>Name: string

Defined in src/sdam/server_description.ts:71

Optional set<wbr>Version

set<wbr>Version: number

Defined in src/sdam/server_description.ts:72

tags

tags: TagSet

Defined in src/sdam/server_description.ts:59

Optional topology<wbr>Version

topology<wbr>Version: TopologyVersion

Defined in src/sdam/server_description.ts:62

type

type: ServerType

Defined in src/sdam/server_description.ts:55

Accessors

all<wbr>Hosts

get allHosts(): string[]

Defined in src/sdam/server_description.ts:153

Returns string[]

host

get host(): string

Defined in src/sdam/server_description.ts:172

Returns string

host<wbr>Address

get hostAddress(): HostAddress

Defined in src/sdam/server_description.ts:148

Returns HostAddress

is<wbr>Data<wbr>Bearing

get isDataBearing(): boolean

Defined in src/sdam/server_description.ts:163

Is this server data bearing

Returns boolean

is<wbr>Readable

get isReadable(): boolean

Defined in src/sdam/server_description.ts:158

Is this server available for reads

Returns boolean

is<wbr>Writable

get isWritable(): boolean

Defined in src/sdam/server_description.ts:168

Is this server available for writes

Returns boolean

port

get port(): number

Defined in src/sdam/server_description.ts:177

Returns number

Methods

equals

equals(other: ServerDescription): boolean

Defined in src/sdam/server_description.ts:186

Determines if another ServerDescription is equal to this one per the rules defined
									in the SDAM spec

Parameters

other: ServerDescription

Returns boolean

						Exports

						Server<wbr>Description

								constructor

								$cluster<wbr>Time

								_host<wbr>Address

								address

								arbiters

								election<wbr>Id

								error

								hosts

								last<wbr>Update<wbr>Time

								last<wbr>Write<wbr>Date

								logical<wbr>Session<wbr>Timeout<wbr>Minutes

								max<wbr>Wire<wbr>Version

								me

								min<wbr>Wire<wbr>Version

								passives

								primary

								round<wbr>Trip<wbr>Time

								set<wbr>Name

								set<wbr>Version

								tags

								topology<wbr>Version

								type

								all<wbr>Hosts

								host

								host<wbr>Address

								is<wbr>Data<wbr>Bearing

								is<wbr>Readable

								is<wbr>Writable

								port

								equals

Legend

Constructor

Property

Method

Accessor

Inherited constructor

Inherited property

Inherited method

Inherited accessor

Constructor

Property

Method

Private property

Private method

Static property

Static method

Generated using TypeDoc

redpajama_set_name: RedPajamaGithub


text:
using Utilities.DataTypes.Comparison;
using Xunit;

namespace UnitTests.DataTypes.Comparison
{
    public class GenericEqualityComparer
    {
        [Fact]
        public void Compare()
        {
            var Comparer = new GenericEqualityComparer<string>();
            Assert.True(Comparer.Equals("A", "A"));
            Assert.False(Comparer.Equals("A", "B"));
            Assert.False(Comparer.Equals("B", "A"));
        }
    }
}


text:
// Copyright 2012 The Closure Library Authors. All Rights Reserved.
//
// 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.

/**
 * @fileoverview Defines an interface for JSON parsing and serialization.
 */

goog.provide('goog.json.Processor');

goog.require('goog.string.Parser');
goog.require('goog.string.Stringifier');

/**
 * An interface for JSON parsing and serialization.
 * @interface
 * @extends {goog.string.Parser}
 * @extends {goog.string.Stringifier}
 */
goog.json.Processor = function() {};


text:
#include <aws/common/linked_list.h>
#include <proof_helpers/make_common_data_structures.h>

void aws_linked_list_insert_after_harness() {
    /* data structure */
    struct aws_linked_list_node after;
    struct aws_linked_list_node after_next;
    struct aws_linked_list_node to_add;

    after.next = &after_next;
    after_next.prev = &after;

    /* perform operation under verification */
    aws_linked_list_insert_after(&after, &to_add);

    /* assertions */
    assert(aws_linked_list_node_next_is_valid(&after));
    assert(aws_linked_list_node_prev_is_valid(&to_add));
    assert(aws_linked_list_node_next_is_valid(&to_add));
    assert(aws_linked_list_node_prev_is_valid(&after_next));

    assert(after.next == &to_add);
    assert(after_next.prev == &to_add);
}


text:
package org.apache.zookeeper.test;

import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.StringReader;
import java.util.regex.Pattern;

import org.apache.zookeeper.TestableZooKeeper;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.common.IOUtils;
import static org.apache.zookeeper.client.FourLetterWordMain.send4LetterWord;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.Timeout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class FourLetterWordsTest extends ClientBase {
    protected static final Logger LOG =
        LoggerFactory.getLogger(FourLetterWordsTest.class);

    @Rule
    public Timeout timeout = new Timeout(30000);

    /** Test the various four letter words */
    @Test
    public void testFourLetterWords() throws Exception {
        verify("ruok", "imok");
        verify("envi", "java.version");
        verify("conf", "clientPort");
        verify("stat", "Outstanding");
        verify("srvr", "Outstanding");
        verify("cons", "queued");
        verify("dump", "Session");
        verify("wchs", "watches");
        verify("wchp", "");
        verify("wchc", "");

        verify("srst", "reset");
        verify("crst", "reset");

        verify("stat", "Outstanding");
        verify("srvr", "Outstanding");
        verify("cons", "queued");

        TestableZooKeeper zk = createClient();
        String sid = getHexSessionId(zk.getSessionId());

        verify("stat", "queued");
        verify("srvr", "Outstanding");
        verify("cons", sid);
        verify("dump", sid);

        zk.getData("/", true, null);

        verify("stat", "queued");
        verify("srvr", "Outstanding");
        verify("cons", sid);
        verify("dump", sid);

        verify("wchs", "watching 1");
        verify("wchp", sid);
        verify("wchc", sid);
        zk.close();

        verify("ruok", "imok");
        verify("envi", "java.version");
        verify("conf", "clientPort");
        verify("stat", "Outstanding");
        verify("srvr", "Outstanding");
        verify("cons", "queued");
        verify("dump", "Session");
        verify("wchs", "watch");
        verify("wchp", "");
        verify("wchc", "");

        verify("srst", "reset");
        verify("crst", "reset");

        verify("stat", "Outstanding");
        verify("srvr", "Outstanding");
        verify("cons", "queued");
        verify("mntr", "zk_server_state\tstandalone");
        verify("mntr", "num_alive_connections");
        verify("stat", "Connections");
        verify("srvr", "Connections");
    }

    private String sendRequest(String cmd) throws IOException {
      HostPort hpobj = ClientBase.parseHostPortList(hostPort).get(0);
      return send4LetterWord(hpobj.host, hpobj.port, cmd);
    }
    private String sendRequest(String cmd, int timeout) throws IOException {
        HostPort hpobj = ClientBase.parseHostPortList(hostPort).get(0);
        return send4LetterWord(hpobj.host, hpobj.port, cmd, timeout);
      }

    private void verify(String cmd, String expected) throws IOException {
        String resp = sendRequest(cmd);
        LOG.info("cmd " + cmd + " expected " + expected + " got " + resp);
        Assert.assertTrue(resp.contains(expected));
    }

    @Test
    public void testValidateStatOutput() throws Exception {
        ZooKeeper zk1 = createClient();
        ZooKeeper zk2 = createClient();

        String resp = sendRequest("stat");
        BufferedReader in = new BufferedReader(new StringReader(resp));

        String line;
        // first line should be version info
        line = in.readLine();
        Assert.assertTrue(Pattern.matches("^.*\\s\\d+\\.\\d+\\.\\d+-.*$", line));
        Assert.assertTrue(Pattern.matches("^Clients:$", in.readLine()));

        int count = 0;
        while ((line = in.readLine()).length() > 0) {
            count++;
            Assert.assertTrue(Pattern.matches("^ /.*:\\d+\\[\\d+\\]\\(queued=\\d+,recved=\\d+,sent=\\d+\\)$", line));
        }
        // ensure at least the two clients we created are accounted for
        Assert.assertTrue(count >= 2);

        line = in.readLine();
        Assert.assertTrue(Pattern.matches("^Latency min/avg/max: \\d+/\\d+/\\d+$", line));
        line = in.readLine();
        Assert.assertTrue(Pattern.matches("^Received: \\d+$", line));
        line = in.readLine();
        Assert.assertTrue(Pattern.matches("^Sent: \\d+$", line));
        line = in.readLine();
        Assert.assertTrue(Pattern.matches("^Connections: \\d+$", line));
        line = in.readLine();
        Assert.assertTrue(Pattern.matches("^Outstanding: \\d+$", line));
        line = in.readLine();
        Assert.assertTrue(Pattern.matches("^Zxid: 0x[\\da-fA-F]+$", line));
        line = in.readLine();
        Assert.assertTrue(Pattern.matches("^Mode: .*$", line));
        line = in.readLine();
        Assert.assertTrue(Pattern.matches("^Node count: \\d+$", line));

        zk1.close();
        zk2.close();
    }

    @Test
    public void testValidateConsOutput() throws Exception {
        ZooKeeper zk1 = createClient();
        ZooKeeper zk2 = createClient();

        String resp = sendRequest("cons");
        BufferedReader in = new BufferedReader(new StringReader(resp));

        String line;
        int count = 0;
        while ((line = in.readLine()) != null && line.length() > 0) {
            count++;
            Assert.assertTrue(line, Pattern.matches("^ /.*:\\d+\\[\\d+\\]\\(queued=\\d+,recved=\\d+,sent=\\d+.*\\)$", line));
        }
        // ensure at least the two clients we created are accounted for
        Assert.assertTrue(count >= 2);

        zk1.close();
        zk2.close();
    }

    @Test(timeout=60000)
    public void testValidateSocketTimeout() throws Exception {
        /**
         * testing positive scenario that even with timeout parameter the
         * functionality works fine
         */
        String resp = sendRequest("isro", 2000);
        Assert.assertTrue(resp.contains("rw"));
    }

    @Test
    public void testSetTraceMask() throws Exception {
        String gtmkResp = sendRequest("gtmk");
        Assert.assertNotNull(gtmkResp);
        gtmkResp = gtmkResp.trim();
        Assert.assertFalse(gtmkResp.isEmpty());
        long formerMask = Long.valueOf(gtmkResp);
        try {
            verify(buildSetTraceMaskRequest(0), "0");
            verify("gtmk", "0");
        } finally {
            // Restore former value.
            sendRequest(buildSetTraceMaskRequest(formerMask));
        }
    }

    /**
     * Builds a SetTraceMask request to be sent to the server, consisting of
     * "stmk" followed by the 8-byte long representation of the trace mask.
     *
     * @param mask trace mask to set
     * @return built request
     * @throws IOException if there is an I/O error
     */
    private String buildSetTraceMaskRequest(long mask) throws IOException {
        ByteArrayOutputStream baos = null;
        DataOutputStream dos = null;
        try {
            baos = new ByteArrayOutputStream();
            dos = new DataOutputStream(baos);
            dos.writeBytes("stmk");
            dos.writeLong(mask);
        } finally {
            IOUtils.closeStream(dos);
            IOUtils.closeStream(baos);
        }
        return new String(baos.toByteArray());
    }
}


text:
package com.suscipio_solutions.consecro_mud.Items.MiscMagic;
import com.suscipio_solutions.consecro_mud.Items.interfaces.RawMaterial;

public class ScrollSpell extends StdScroll
{
	@Override public String ID(){	return "ScrollSpell";}
	public ScrollSpell()
	{
		super();
		this.setUsesRemaining(2);
		baseGoldValue=200;
		recoverPhyStats();
		material=RawMaterial.RESOURCE_PAPER;
	}
}


text:
package com.kongo2002.android.prost

import android.os.Bundle

import com.google.android.gms.maps.CameraUpdate
import com.google.android.gms.maps.CameraUpdateFactory
import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.SupportMapFragment
import com.google.android.gms.maps.model.LatLng

class BarsMapActivity extends TypedFragmentActivity
  with Loggable {

  var map : GoogleMap = null

  override def onCreate(bundle: Bundle) {
    super.onCreate(bundle)

    /* load maps view */
    setContentView(R.layout.bars_map_activity)
    prepareMap

    logI("onCreate")
  }

  override def onResume {
    super.onResume

    prepareMap
  }

  private def prepareMap {
    if (map == null) {
      /* Try to obtain the map from the SupportMapFragment */
      val manager = getSupportFragmentManager
      val fragment = manager.findFragmentById(R.id.map).asInstanceOf[SupportMapFragment]
      map = fragment.getMap

      /* Check if we were successful in obtaining the map */
      if (map != null) {
        Maps.setUpMap(map)
      }
    }
  }

  override def onDestroy {
    super.onDestroy

    logI("onDestroy")
  }

  override def onPause {
    super.onPause

    logI("onPause")
  }
}

/* vim: set et sw=2 sts=2 tw=120: */


text:
namespace UISleuth.Messages
{
    internal class DeleteWidgetRequest : Request, IWidgetMessage
    {
        public string WidgetId { get; set; }
    }
}


text:
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>IT Magix Pipeline Dummy Application</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
    <p th:text="'Hi there, ' + ${name} + '!'" />
    <p> Do Fix IT! In da house</p>
</body>
</html>


text:
div {
	width: 600px;

	border-top: 5px solid red;
	border-right: 2px solid black;
	border-bottom: 2px solid green;
	border-left: 5px solid blue;

	border: 5px dotted blue;
	border: 5px dashed blue;
	border: 5px groove blue;
	border: 5px ridge blue;

}


text:
<?php
if (is_page()) {
$post_id = 4963;
$queried_post = get_post($post_id);
$content = $queried_post->post_content;
$content = apply_filters('the_content', $content);
if ($content) { // if there is a special announcement or a weather alert ?>

        <?php echo $content; //content for the desktop special announcements ?>

    <?php echo _e('Special Announcement', 'foundationpress') ?>…

      <?php echo "$content";  //content for the mobile special announcements  ?>
      ×

<?php }  // if there is not a special announcement or weather alert do nothing.
else {
}
}
?>


text:
#if defined(BOOST_MSVC)
#pragma warning(disable: 4786)  // identifier truncated in debug info
#pragma warning(disable: 4710)  // function not inlined
#pragma warning(disable: 4711)  // function selected for automatic inline expansion
#pragma warning(disable: 4514)  // unreferenced inline removed
#endif

//
//  bind_rv_sp_test.cpp - smart pointer returned by value from an inner bind
//
//  Copyright (c) 2005 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//

#include <boost/bind.hpp>

#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
#pragma warning(push, 3)
#endif

#include <iostream>

#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
#pragma warning(pop)
#endif

#include <boost/detail/lightweight_test.hpp>
#include <boost/shared_ptr.hpp>

struct X
{
    int v_;

    X( int v ): v_( v )
    {
    }

    int f()
    {
        return v_;
    }
};

struct Y
{
    boost::shared_ptr<X> f()
    {
        return boost::shared_ptr<X>( new X( 42 ) );
    }
};

int main()
{
    Y y;

    BOOST_TEST( boost::bind( &X::f, boost::bind( &Y::f, &y ) )() == 42 );

    return boost::report_errors();
}


text:
#include "NVRenderStates.h"

void state_ui(bool enabled) {
    if (enabled) {
        glEnableClientState(GL_VERTEX_ARRAY);
        glEnableClientState(GL_TEXTURE_COORD_ARRAY);
        glEnable(GL_TEXTURE_2D);
        glEnable(GL_BLEND);

        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

        glDisable(GL_DEPTH_TEST);
        glDisable(GL_LIGHTING);
    } else {
        glDisableClientState(GL_VERTEX_ARRAY);
        glDisableClientState(GL_TEXTURE_COORD_ARRAY);
        glDisable(GL_BLEND);
        glDisable(GL_TEXTURE_2D);
    }
}

void state_fullscreen_rectangle(bool enabled) {
    if (enabled) {
        glEnableClientState(GL_VERTEX_ARRAY);
        glEnable(GL_CULL_FACE);
        glEnable(GL_BLEND);

        glCullFace(GL_BACK);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        glShadeModel(GL_SMOOTH);

        glDisable(GL_DEPTH_TEST);
        glDisable(GL_LIGHTING);
    } else {
        glDisableClientState(GL_VERTEX_ARRAY);
        glDisable(GL_CULL_FACE);
        glDisable(GL_BLEND);
    }
}

void state_screenspaced_rectangle(bool enabled) {
    if (enabled) {
        glEnableClientState(GL_VERTEX_ARRAY);
        glEnable(GL_CULL_FACE);

        glCullFace(GL_BACK);

        glDisable(GL_DEPTH_TEST);
        glDisable(GL_LIGHTING);
    } else {
        glDisableClientState(GL_VERTEX_ARRAY);
        glDisable(GL_CULL_FACE);
    }
}


text:
describe "A Symbol literal" do
  it "must not be an empty string" do
    lambda { eval ":''" }.should raise_error(SyntaxError)
  end
end


text:
<?php

declare(strict_types=1);

namespace Overblog\GraphQLBundle\Annotation;

use Attribute;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;

/**
 * Annotation for GraphQL argument.
 *
 * @Annotation
 * @NamedArgumentConstructor
 * @Target({"ANNOTATION","PROPERTY","METHOD"})
 */
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
final class Arg extends Annotation
{
    /**
     * Argument name.
     */
    public string $name;

    /**
     * Argument description.
     */
    public ?string $description;

    /**
     * Argument type.
     */
    public string $type;

    /**
     * Default argument value.
     *
     * @var mixed
     */
    public $default;

    /**
     * @param string      $name        The name of the argument
     * @param string      $type        The type of the argument
     * @param string|null $description The description of the argument
     * @param mixed|null  $default     Default value of the argument
     */
    public function __construct(string $name, string $type, ?string $description = null, $default = null)
    {
        $this->name = $name;
        $this->description = $description;
        $this->type = $type;
        $this->default = $default;
    }
}


text:
using Itera.Fagdag.November.Domain.Models;
using Itera.Fagdag.November.Repositories.Contracts;
using Itera.Fagdag.November.Services.Contracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Itera.Fagdag.November.Services
{
    public class ProductService : IProductService
    {
        private readonly IProductRepository _productRepository;

        public ProductService(IProductRepository productRepository)
        {
            _productRepository = productRepository;
        }

        public IEnumerable<Product> GetProducts()
        {
            return _productRepository.GetProducts();
        }

        public Product GetProduct(int id)
        {
            return _productRepository.GetProduct(id);
        }

        public void Update(Product product)
        {
            _productRepository.Update(product);
        }

        public void Remove(Product product)
        {
            _productRepository.Remove(product);
        }

        public void Add(Product product)
        {
            _productRepository.Add(product);
        }
    }
}


text:
USE [AnteroAPI]
GO
/****** Object:  Table [api].[amm_rahoitus_opiskelijavuodet]    Script Date: 23.9.2022 16:15:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[api].[amm_rahoitus_opiskelijavuodet]') AND type in (N'U'))
BEGIN
CREATE TABLE [api].[amm_rahoitus_opiskelijavuodet](
	[defaultorder] [bigint] NOT NULL,
	[tilastovuosi] [int] NOT NULL,
	[tilastokuukausi] [int] NOT NULL,
	[sukupuoli] [nvarchar](100) NOT NULL,
	[aidinkieli] [nvarchar](100) NOT NULL,
	[ika] [nvarchar](100) NOT NULL,
	[tutkinto] [nvarchar](200) NOT NULL,
	[osaamisala] [nvarchar](200) NOT NULL,
	[suorituksen_tyyppi] [varchar](255) NOT NULL,
	[suorituskieli] [nvarchar](100) NOT NULL,
	[kustannusryhma] [nvarchar](100) NOT NULL,
	[rahoitusmuoto] [nvarchar](100) NOT NULL,
	[erityisopetus] [varchar](100) NOT NULL,
	[majoitus] [varchar](100) NOT NULL,
	[oppivelvollisuus] [varchar](20) NOT NULL,
	[osa_aikaisuus_kylla_ei] [bit] NOT NULL,
	[oppisopimuskoulutus_kylla_ei] [bit] NOT NULL,
	[vankilaopetus_kylla_ei] [bit] NOT NULL,
	[henkilostokoulutus_kylla_ei] [bit] NOT NULL,
	[tyovoimakoulutus_kylla_ei] [bit] NOT NULL,
	[hankintakoulutus_kylla_ei] [bit] NOT NULL,
	[koulutuksen_jarjestaja] [nvarchar](500) NOT NULL,
	[koulutuksen_jarjestajan_kunta] [nvarchar](200) NOT NULL,
	[hankintakoulutuksen_jarjestaja] [nvarchar](500) NOT NULL,
	[hankintakoulutuksen_jarjestajan_kunta] [nvarchar](200) NOT NULL,
	[oppilaitos] [nvarchar](500) NOT NULL,
	[oppilaitoksen_kunta] [nvarchar](200) NOT NULL,
	[toimipiste] [nvarchar](500) NOT NULL,
	[hyvaksytyt_hylatyt_opiskelijavuodet] [nvarchar](100) NOT NULL,
	[luvaton_koulutus] [varchar](255) NOT NULL,
	[luvaton_majoitus] [varchar](255) NOT NULL,
	[luvaton_korotustekija] [varchar](255) NOT NULL,
	[luvanmukainen_suorituskieli] [varchar](33) NOT NULL,
	[koodit_koulutuksen_jarjestaja] [varchar](20) NOT NULL,
	[koodit_koulutuksen_jarjestajan_kunta] [varchar](3) NOT NULL,
	[koodit_hankintakoulutuksen_jarjestaja] [varchar](20) NOT NULL,
	[koodit_hankintakoulutuksen_jarjestajan_kunta] [varchar](3) NOT NULL,
	[koodit_oppilaitos] [varchar](20) NOT NULL,
	[koodit_oppilaitoksen_kunta] [varchar](3) NOT NULL,
	[koodit_tutkinto] [varchar](6) NOT NULL,
	[koodit_osaamisala] [nvarchar](5) NOT NULL,
	[opiskelijavuoden_tyyppi] [varchar](255) NOT NULL,
	[opiskelijavuodet_painottamaton] [decimal](20, 10) NOT NULL,
	[opiskelijavuodet_painotettu] [decimal](20, 10) NOT NULL,
 CONSTRAINT [PK_amos_opiskelijavuodet] PRIMARY KEY CLUSTERED
(
	[defaultorder] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  Table [dw].[api_amm_rahoitus_opiskelijavuodet]    Script Date: 23.9.2022 16:15:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dw].[api_amm_rahoitus_opiskelijavuodet]') AND type in (N'U'))
BEGIN
CREATE TABLE [dw].[api_amm_rahoitus_opiskelijavuodet](
	[defaultorder] [bigint] NOT NULL,
	[tilastovuosi] [int] NOT NULL,
	[tilastokuukausi] [int] NOT NULL,
	[sukupuoli] [nvarchar](100) NOT NULL,
	[aidinkieli] [nvarchar](100) NOT NULL,
	[ika] [nvarchar](100) NOT NULL,
	[tutkinto] [nvarchar](200) NOT NULL,
	[koodit_tutkinto] [varchar](6) NOT NULL,
	[osaamisala] [nvarchar](200) NOT NULL,
	[koodit_osaamisala] [nvarchar](5) NOT NULL,
	[suorituksen_tyyppi] [varchar](255) NOT NULL,
	[suorituskieli] [nvarchar](100) NOT NULL,
	[kustannusryhma] [nvarchar](100) NOT NULL,
	[rahoitusmuoto] [nvarchar](100) NOT NULL,
	[erityisopetus] [varchar](100) NOT NULL,
	[majoitus] [varchar](100) NOT NULL,
	[oppivelvollisuus] [varchar](20) NOT NULL,
	[osa_aikaisuus_kylla_ei] [bit] NOT NULL,
	[oppisopimuskoulutus_kylla_ei] [bit] NOT NULL,
	[vankilaopetus_kylla_ei] [bit] NOT NULL,
	[henkilostokoulutus_kylla_ei] [bit] NOT NULL,
	[tyovoimakoulutus_kylla_ei] [bit] NOT NULL,
	[hankintakoulutus_kylla_ei] [bit] NOT NULL,
	[koulutuksen_jarjestaja] [nvarchar](500) NOT NULL,
	[koodit_koulutuksen_jarjestaja] [varchar](20) NOT NULL,
	[koulutuksen_jarjestajan_kunta] [nvarchar](200) NOT NULL,
	[koodit_koulutuksen_jarjestajan_kunta] [varchar](3) NOT NULL,
	[hankintakoulutuksen_jarjestaja] [nvarchar](500) NOT NULL,
	[koodit_hankintakoulutuksen_jarjestaja] [varchar](20) NOT NULL,
	[hankintakoulutuksen_jarjestajan_kunta] [nvarchar](200) NOT NULL,
	[koodit_hankintakoulutuksen_jarjestajan_kunta] [varchar](3) NOT NULL,
	[oppilaitos] [nvarchar](500) NOT NULL,
	[koodit_oppilaitos] [varchar](20) NOT NULL,
	[oppilaitoksen_kunta] [nvarchar](200) NOT NULL,
	[koodit_oppilaitoksen_kunta] [varchar](3) NOT NULL,
	[toimipiste] [nvarchar](500) NOT NULL,
	[hyvaksytyt_hylatyt_opiskelijavuodet] [nvarchar](100) NOT NULL,
	[luvaton_koulutus] [varchar](255) NOT NULL,
	[luvaton_majoitus] [varchar](255) NOT NULL,
	[luvaton_korotustekija] [varchar](255) NOT NULL,
	[luvanmukainen_suorituskieli] [varchar](33) NOT NULL,
	[opiskelijavuoden_tyyppi] [varchar](255) NOT NULL,
	[opiskelijavuodet_painottamaton] [decimal](20, 10) NOT NULL,
	[opiskelijavuodet_painotettu] [decimal](20, 10) NOT NULL
) ON [PRIMARY]
END

GO

USE ANTERO


text:
/*
 * Note: Lincoln's Gettysburg Address is in the public domain. See LICENSE.
 */

package org.apache.datasketches.memory.test;

import static org.apache.datasketches.memory.internal.Util.characterPad;
import static org.apache.datasketches.memory.internal.Util.getResourceBytes;
import static org.apache.datasketches.memory.internal.Util.getResourceFile;
import static org.apache.datasketches.memory.internal.Util.negativeCheck;
import static org.apache.datasketches.memory.internal.Util.nullCheck;
import static org.apache.datasketches.memory.internal.Util.zeroCheck;
import static org.apache.datasketches.memory.internal.Util.zeroPad;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.attribute.PosixFileAttributeView;
import java.nio.file.attribute.PosixFileAttributes;
import java.nio.file.attribute.PosixFilePermissions;

import org.apache.datasketches.memory.internal.UnsafeUtil;
import org.apache.datasketches.memory.internal.Util;
import org.apache.datasketches.memory.WritableMemory;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class UtilTest {
  private static final String LS = System.getProperty("line.separator");

  //Binary Search
  @Test
  public void checkBinarySearch() {
    int k = 1024; //longs
    WritableMemory wMem = WritableMemory.allocate(k << 3); //1024 longs
    for (int i = 0; i < k; i++) { wMem.putLong(i << 3, i); }
    long idx = Util.binarySearchLongs(wMem, 0, k - 1, k / 2);
    long val = wMem.getLong(idx << 3);
    assertEquals(idx, k/2);
    assertEquals(val, k/2);

    idx = Util.binarySearchLongs(wMem, 0, k - 1, k);
    assertEquals(idx, -1024);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void checkBoundsTest() {
    UnsafeUtil.checkBounds(999, 2, 1000);
  }

  @Test
  public void checkPadding() {
    String s = "123";
    String t = zeroPad(s, 4);
    assertTrue(t.startsWith("0"));

    t = characterPad(s, 4, '0', true);
    assertTrue(t.endsWith("0"));

    t = characterPad(s, 3, '0', false);
    assertEquals(s, t);
  }

  @Test
  public void checkNullZeroNegativeChecks() {
    Object obj = null;
    try {
      nullCheck(obj, "Test Object");
      fail();
    } catch (IllegalArgumentException e) {
      //OK
    }
    try {
      zeroCheck(0, "Test Long");
      fail();
    } catch (IllegalArgumentException e) {
      //OK
    }
    try {
      negativeCheck(-1L, "Test Long");
      fail();
    } catch (IllegalArgumentException e) {
      //OK
    }
  }

  @Test
  public void checkCodePointArr() {
    final Util.RandomCodePoints rvcp = new Util.RandomCodePoints(true);
    final int n = 1000;
    final int[] cpArr = new int[n];
    rvcp.fillCodePointArray(cpArr);
    for (int i = 0; i < n; i++) {
      int cp = cpArr[i];
      if ((cp >= Character.MIN_SURROGATE) && (cp <= Character.MAX_SURROGATE)) {
        fail();
      }
    }
  }

  @Test
  public void checkCodePoint() {
    final Util.RandomCodePoints rvcp = new Util.RandomCodePoints(true);
    final int n = 1000;
    for (int i = 0; i < n; i++) {
      int cp = rvcp.getCodePoint();
      if ((cp >= Character.MIN_SURROGATE) && (cp <= Character.MAX_SURROGATE)) {
        fail();
      }
    }
  }

  static final String getFileAttributes(File file) {
    try {
    PosixFileAttributes attrs = Files.getFileAttributeView(
        file.toPath(), PosixFileAttributeView.class, new LinkOption[0]).readAttributes();
    String s = String.format("%s: %s %s %s%n",
        file.getPath(),
        attrs.owner().getName(),
        attrs.group().getName(),
        PosixFilePermissions.toString(attrs.permissions()));
    return s;
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }

  static final void setGettysburgAddressFileToReadOnly() {
    File file = getResourceFile("GettysburgAddress.txt");
    try {
    Files.setPosixFilePermissions(file.toPath(), PosixFilePermissions.fromString("r--r--r--"));
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }

  //Resources

  @Test
  public void resourceFileExits() {
    final String shortFileName = "GettysburgAddress.txt";
    final File file = getResourceFile(shortFileName);
    assertTrue(file.exists());
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void resourceFileNotFound() {
    final String shortFileName = "GettysburgAddress.txt";
    getResourceFile(shortFileName + "123");
  }

  @Test
  public void resourceBytesCorrect() {
    final String shortFileName = "GettysburgAddress.txt";
    final byte[] bytes = getResourceBytes(shortFileName);
    assertTrue(bytes.length == 1541);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void resourceBytesFileNotFound() {
    final String shortFileName = "GettysburgAddress.txt";
    getResourceBytes(shortFileName + "123");
  }

  @Test
  public void printlnTest() {
    println("PRINTING: "+this.getClass().getName());
  }

  static void println(final Object o) {
    if (o == null) { print(LS); }
    else { print(o.toString() + LS); }
  }

  /**
   * @param o value to print
   */
  static void print(final Object o) {
    if (o != null) {
      //System.out.print(o.toString()); //disable here
    }
  }

}


text:
require 'fileutils'

module PhotoLibrary
  class Cli

    class << self
      include PhotoLibrary::Helper

      def run *args
        if args.empty?
          self.usage
        else
          self.send(args.shift.gsub("-", "_"), *args)
        end
      end

      # print the usage string, this is a fall through method.
      def usage
        puts %{
  Usage: photo-library ACTION [Arg]

  ACTIONS:
  add [SOURCE_PATH] [-R] [-C]
      add photo from [SOURCE_PATH], if [SOURCE_PATH] is not present, use current folder.
      alias : a / --a / --add

      [-R] recrusive processing photo in SOURCE_PATH
      [-C] clean up after processing the file, (some of files will be removed)

      After processing, it will generate a summary of processing

  list [searchable] [config]
      list information
      alias : l or ls

      [searchable] show search able exif key
      [config] show config information

  search ['exifkey = value']
      alias : s

      create a new project file and open it in your editor

  summary [exifkey]
      print out the library summary
      [exifkey] print out the library uniq summary for one special exif key, value and count

  help
      alias : --help / -h
      shows this help document

  version
      alias : --version
      shows photo-library version number
}
      end

      alias :help :usage
      alias :__help :usage
      alias :_h :usage

=begin
      # Open a config file, it's created if it doesn't exist already.
      def open *args
        exit!("You must specify a name for the new project") unless args.size > 0
        puts "warning: passing multiple arguments to open will be ignored" if args.size > 1
        @name = args.shift
        config_path = "#{root_dir}#{@name}.yml"
        unless File.exists?(config_path)
          template = File.exists?(user_config) ? user_config : sample_config
          erb      = ERB.new(File.read(template)).result(binding)
          tmp      = File.open(config_path, 'w') {|f| f.write(erb) }
        end
        system("$EDITOR #{config_path}")
      end
      alias :o :open
      alias :new :open
      alias :n :open
=end

      def summary *args
        puts "= Summary ="
      end
      alias :__summary :summary

=begin
      def copy *args
        @copy = args.shift
        @name = args.shift
        @config_to_copy = "#{root_dir}#{@copy}.yml"

        exit!("Project #{@copy} doesn't exist!")             unless File.exists?(@config_to_copy)
        exit!("You must specify a name for the new project") unless @name

        file_path = "#{root_dir}#{@name}.yml"

        if File.exists?(file_path)
          confirm!("#{@name} already exists, would you like to overwrite it? (type yes or no):") do
            FileUtils.rm(file_path)
            puts "Overwriting #{@name}"
          end
        end
        open @name
      end
      alias :c :copy

      def delete *args
        puts "warning: passing multiple arguments to delete will be ignored" if args.size > 1
        filename  = args.shift
        file_path = "#{root_dir}#{filename}.yml"

        if File.exists?(file_path)
          confirm!("Are you sure you want to delete #{filename}? (type yes or no):") do
            FileUtils.rm(file_path)
            puts "Deleted #{filename}"
          end
        else
          exit! "That file doesn't exist."
        end
      end
      alias :d :delete

      def implode *args
        exit!("delete_all doesn't accapt any arguments!") unless args.empty?
        confirm!("Are you sure you want to delete all tmuxinator configs? (type yes or no):") do
          FileUtils.remove_dir(root_dir)
          puts "Deleted #{root_dir}"
        end
      end
      alias :i :implode
=end

      def list *args
        verbose = args.include?("-v")
        puts "tmuxinator configs:"
        Dir["#{root_dir}**"].each do |path|
          next unless verbose || File.extname(path) == ".yml"
          path = path.gsub(root_dir, '').gsub('.yml','') unless verbose
          puts "    #{path}"
        end
      end

      alias :l :list
      alias :ls :list

      def version
        system("cat #{File.dirname(__FILE__) + '/../../VERSION'}")
      end
      alias :v :version

      def doctor
        print "  checking if tmux is installed ==> "
        puts system("which tmux > /dev/null") ?  "Yes" : "No"
        print "  checking if $EDITOR is set ==> "
        puts ENV['EDITOR'] ? "Yes" : "No"
        print "  checking if $SHELL is set ==> "
        puts ENV['SHELL'] ? "Yes" : "No"
      end

      # build script and run it
      def start *args
        exit!("You must specify a name for the new project") unless args.size > 0
        puts "warning: passing multiple arguments to open will be ignored" if args.size > 1
        project_name = args.shift
        config_path = "#{root_dir}#{project_name}.yml"
        config = Tmuxinator::ConfigWriter.new(config_path).render
        # replace current proccess by running compiled tmux config
        exec(config)
      end
      alias :s :start

      def method_missing method, *args, &block
        start method if File.exists?("#{root_dir}#{method}.yml")
        puts "There's no command '#{method}' in photo-library"
        usage
      end

      private #==============================

      def root_dir
        # create ~/.tmuxinator directory if it doesn't exist
        Dir.mkdir("#{ENV["HOME"]}/.tmuxinator/") unless File.directory?(File.expand_path("~/.tmuxinator"))
        sub_dir = File.join(File.expand_path(Dir.pwd), '.tmuxinator/')
        if File.directory?(sub_dir)
          return sub_dir
        else
          return "#{ENV["HOME"]}/.tmuxinator/"
        end
      end

      def sample_config
        "#{File.dirname(__FILE__)}/assets/sample.yml"
      end

      def user_config
        @config_to_copy || "#{ENV["HOME"]}/.tmuxinator/default.yml"
      end

    end

  end
end


text:
#import "RNSVGRadialGradientManager.h"
#import "RNSVGRadialGradient.h"

@implementation RNSVGRadialGradientManager

RCT_EXPORT_MODULE()

- (RNSVGNode *)node
{
  return [RNSVGRadialGradient new];
}

RCT_EXPORT_VIEW_PROPERTY(fx, NSString)
RCT_EXPORT_VIEW_PROPERTY(fy, NSString)
RCT_EXPORT_VIEW_PROPERTY(rx, NSString)
RCT_EXPORT_VIEW_PROPERTY(ry, NSString)
RCT_EXPORT_VIEW_PROPERTY(cx, NSString)
RCT_EXPORT_VIEW_PROPERTY(cy, NSString)
RCT_EXPORT_VIEW_PROPERTY(gradient, NSArray<NSNumber *>)

@end


text:
import { Meteor } from 'meteor/meteor'
import { render } from 'react-dom'
import renderRoutes from './routes'

Meteor.startup(() => {
  render(renderRoutes(), document.getElementById('app'))
});


text:
title: Documents
page_title: Documents | RadEditor for ASP.NET AJAX Documentation
description: Documents
slug: editor/functionality/dialogs/file-browser-dialogs/documents
tags: documents
published: True
position: 2
---

# Documents

Functionality:

Using the Document Manager dialog, RadEditor users can:

* **insert documents** in the editor's content area

* **upload new documents**, which will be available for inserting.

* **delete documents**

Properties to set:

The behavior of the Document Manager dialog is controlled by the following properties:

|  **Property**  |  **Description**  |
| ------ | ------ |
| **ViewPaths** |A string array which contains the paths where the RadEditor will look for documents. The default value is an empty array. These folders will be visible in the file browser part of the dialog.|
| **UploadPaths** |A string array which contains the paths to which the RadEditor will be able to upload documents. The default value is an empty string array. The elements of this array must be a subset of the ViewPaths array.|
| **DeletePaths** |A string array which contains the paths from which the RadEditor will be able to delete documents. The default value is an empty string array. The elements of this array must be a subset of the ViewPaths array.|
| **MaxUploadFileSize** |The maximum document file size in bytes, allowed for uploading. The default value is **204800** bytes (200 kilobytes).|
| **SearchPatterns** |A string array which contains the file extension filters that controls which files are shown in the Document Manager dialog and which file types can be uploaded through the upload dialog.The * character can be used as a wildcard in the file name, for example *.doc will match all document names with extension doc.|

In order for a folder to be visible in the file browser, it must be present in the ViewPaths array. The users will be able to browse its subfolders since they inherit the permissions. If it is needed to grant permission for deleting or uploading documents into a specific folder, it must be present in the corresponding array - DeletePaths or UploadPaths. These permissions are also inherited by the subfolders.The application root folder can be substituted with the "~" (tilde) character. It is possible to use paths relative to the root. For example, in order to access Document files located in another web application.

**Example 1** and **Example 2** demonstrate the relationship between the folder structure and the property settings:

The users will be able to browse all subfolders of the "~/Documents" folder. They will be able to upload documents to the "~/Documents/New" folder and all its subfolders and delete documents from "~/Documents/New/Articles" and "~/Documents/New/News".

>caption Example 1: Setting Document manager properties inline.

````ASP.NET
<telerik:RadEditor runat="server" ID="RadEditor1">
	<DocumentManager ViewPaths="~/Documents" UploadPaths="~/Documents/New" DeletePaths="~/Documents/New/Articles,~/Documents/New/News" />
</telerik:RadEditor>
````

>caption Example 2: Setting Document manager properties in CodeBehind.

````C#
string[] viewDocuments = new string[] { "~/Documents" };
string[] uploadDocuments = new string[] { "~/Documents/New" };
string[] deleteDocuments = new string[] { "~/Documents/New/Articles", "~/Documents/New/News" };

if (!IsPostBack)
{
	RadEditor1.DocumentManager.ViewPaths = viewDocuments;
	RadEditor1.DocumentManager.UploadPaths = uploadDocuments;
	RadEditor1.DocumentManager.DeletePaths = deleteDocuments;
}
````
````VB
Dim viewDocuments As String() = New String() {"~/Documents"}
Dim uploadDocuments As String() = New String() {"~/Documents/New"}
Dim deleteDocuments As String() = New String() {"~/Documents/New/Articles", "~/Documents/New/News"}

If Not IsPostBack Then
	RadEditor1.DocumentManager.ViewPaths = viewDocuments
	RadEditor1.DocumentManager.UploadPaths = uploadDocuments
	RadEditor1.DocumentsManager.DeletePaths = deleteDocuments
End If
````

Note that the viewDocuments, uploadDocuments and deleteDocuments variables are string arrays and that the Documents folder must be:

* a subdirectory of your web application

* directory placed in the root of IIS - you can set this folder by using the / forward slash symbol, e.g. `RadEditor1.DocumentManager.ViewPaths = new String []{"/Documents"};`

* a virtual directory of your web application that has a physical path pointing outside of your web application.

>important The Links inserted via the **DocumentManager** have **relative paths**. In scenarios when **absolute paths** are needed enable the **MakeUrlsAbsolute** client-side filter of RadEditor:
* via the codebehind: RadEditor1.EnableFilter(EditorFilters. **MakeUrlsAbsolute** );
* inline: `<telerik:RadEditor ID="RadEditor1" ContentFilters="MakeUrlsAbsolute" runat="server" />`

## See Also

 * [Set Properties]({%slug editor/getting-started/set-properties%})

 * [Enforce Roles]({%slug editor/functionality/dialogs/examples/enforce-roles%})

 * [File Managers](http://demos.telerik.com/aspnet/prometheus/Editor/Examples/FileManagers/DefaultCS.aspx)

 * [DB File Browser Content Provider](http://demos.telerik.com/aspnet/prometheus/Editor/Examples/DBFileBrowserContentProvider/DefaultCS.aspx)

 * [Content Filters]({%slug editor/managing-content/content-filters%})


text:
using UnityEngine;

public class PneumaticSolenoid : CorrelatedObject {

    [ViewOnly] public bool active;

    SpriteRenderer spriteRenderer;

    protected override CorrelationTarget[] GetCorrelationTargets() {
        return SimulationPanel.instance.GetActiveSolenoids();
    }

    protected override string CreateConfigWindowTitle() {
        return "Select a Solenoid:";
    }

    void Start() {
        GetComponentInParent<ComponentReferences>().AddPneumaticSolenoid(this);
        spriteRenderer = GetComponent<SpriteRenderer>();
    }

    public void Activate() {
        spriteRenderer.color = Color.green;
        active = true;
    }

    public void Deactivate() {
        spriteRenderer.color = Color.white;
        active = false;
    }
}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;

namespace DLaB.XrmToolBoxCommon.Editors
{
    public class CollectionCountConverter : TypeConverter
    {
        public const string Name = "DLaB.XrmToolBoxCommon.Editors.CollectionCountConverter";

        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType != typeof(string))
            {
                return base.ConvertTo(context, culture, value, destinationType);
            }

            var type = value.GetType();

            if (type.IsGenericType)
            {
                return ConvertGenericTypeToString(context, culture, value, destinationType);
            }

            return ConvertCollectionToString(context, culture, value, destinationType);
        }

        private string ConvertCollectionToString(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            return value is ICollection collection
                ? GetDisplayCount(context, value, collection.Count)
                : (string)base.ConvertTo(context, culture, value, destinationType);
        }

        private string ConvertGenericTypeToString(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            var type = value.GetType();
            var collectionType = type.GetInterfaces().FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(ICollection<>));
            if(collectionType == null)
            {
                return ConvertCollectionToString(context, culture, value, destinationType);
            }

            // Handle Collection<KeyValuePair<KeyType,ValueType>>
            var firstGenericType = collectionType.GenericTypeArguments[0];
            if (firstGenericType.IsGenericType
                && firstGenericType.GetGenericTypeDefinition() == typeof(KeyValuePair<,>))
            {
                // Check if ValueType is ICollection
                var kvpValueType = firstGenericType.GenericTypeArguments[1];
                if (kvpValueType.IsGenericType
                    && kvpValueType.GetInterfaces().Any(i =>
                        i.IsGenericType
                        && (i.GetGenericTypeDefinition() == typeof(ICollection<>)
                            || i.GetGenericTypeDefinition() == typeof(ICollection))))
                {
                    return GetDisplayCountForCollectionOfKvp(context, value);
                }
            }

            return GetDisplayCount(context, value, ((dynamic) value).Count);

        }

        private static string GetDisplayCountForCollectionOfKvp(ITypeDescriptorContext context, object value)
        {
            var count = (from object pairs in (IEnumerable) value
                    select ((dynamic) pairs)?.Value?.Count)
                .Aggregate(0, (current, c) => current + (c == 0 ? 1 : c));
            return GetDisplayCount(context, value, count);
        }

        private static string GetDisplayCount(ITypeDescriptorContext context, object value, int count)
        {
            var info = (CollectionCountAttribute)context?.PropertyDescriptor?.Attributes.Cast<Attribute>().FirstOrDefault(a => a is CollectionCountAttribute)
                       ?? new CollectionCountAttribute();

            string text;
            switch (count)
            {
                case 0:
                    text = info.GetDisplayCountForNone();
                    break;
                case 1:
                    text = info.GetDisplayCountForOne(((IEnumerable) value).Cast<object>().First());
                    break;
                default:
                    text = "Count: " + count;
                    break;
            }

            return text;
        }
    }

    [AttributeUsage(AttributeTargets.Property)]
    public class CollectionCountAttribute : Attribute
    {
        public string None { get; set; }
        public string OneValueLongFormat { get; set; }
        public string OneValueShortFormat { get; set; }
        public string CountFormat { get; set; }
        public int OneValueMaxDisplayLength { get; set; }

        public CollectionCountAttribute(string none = "(None)", string oneValueLongFormat = "({0})", string oneValueShortFormat = "({0}...)", string countFormat = "Count: {0}", int oneValueMaxDisplayLength = 30)
        {
            None = none;
            OneValueLongFormat = oneValueLongFormat;
            OneValueShortFormat = oneValueShortFormat;
            CountFormat = countFormat;
            OneValueMaxDisplayLength = oneValueMaxDisplayLength;
        }

        public virtual string GetDisplayCountForNone()
        {
            return None;
        }

        public virtual string GetDisplayCountForOne(object value)
        {
            var first = value.ToString();

            var longLabel = string.Format(OneValueLongFormat, first);
            if (longLabel.Length <= OneValueMaxDisplayLength)
            {
                return longLabel;
            }

            var shortLabel = string.Format(OneValueShortFormat, first);
            var excessCharacters = OneValueMaxDisplayLength - shortLabel.Length;
            if (excessCharacters <= 0)
            {
                return shortLabel;
            }

            return first.Length <= excessCharacters
                ? GetDisplayCount(1)
                : string.Format(OneValueShortFormat, first.Substring(0, first.Length - excessCharacters));
        }

        public virtual string GetDisplayCount(int count)
        {
            return string.Format(CountFormat, count);
        }
    }
}


text:
<script type="text/javascript">
  (function (designWidth, rem2px) {
    var win = window;
    var doc = win.document;
    var docEl = doc.documentElement;
    var metaEl = doc.querySelector('meta[name="viewport"]');
    var dpr = 0;
    var scale = 0;
    var tid;
    /*是否是移动环境*/
    var isMob = false;
    if (!dpr && !scale) {
      if (win.navigator.appVersion.match(/iphone|ipad|Android/gi)) {
        isMob = true;
        var devicePixelRatio = win.devicePixelRatio;
        if (devicePixelRatio >= 3 && (!dpr || dpr >= 3)) {
          dpr = 3;
        } else if (devicePixelRatio >= 2 && (!dpr || dpr >= 2)) {
          dpr = 2;
        } else {
          dpr = 1;
        }
      } else {
        /*非移动设备环境*/
        dpr = 1;
      }
      scale = 1 / dpr;
    }

    docEl.setAttribute('data-dpr', dpr);

    if (!metaEl) {
      metaEl = doc.createElement('meta');
      metaEl.setAttribute('name', 'viewport');
      metaEl.setAttribute('content', 'width=device-width,initial-scale=' + scale + ', maximum-scale=' + scale +
        ', minimum-scale=' + scale + ', user-scalable=no');

      if (docEl.firstElementChild) {
        docEl.firstElementChild.appendChild(metaEl);
      } else {
        var wrap = doc.createElement('div');
        wrap.appendChild(metaEl);
        doc.write(wrap.innerHTML);
      }
    } else {
      metaEl.setAttribute('name', 'viewport');
      metaEl.setAttribute('content', 'width=device-width,initial-scale=' + scale + ', maximum-scale=' + scale +
        ', minimum-scale=' + scale + ', user-scalable=no');
    }
    /*
     以上代码是对 dpr 和 viewport 的处理,代码来自 lib-flexible。

     一下代码是处理 rem,来自上篇文章。不同的是获取屏幕宽度使用的是
     document.documentElement.getBoundingClientRect
     也是来自 lib-flexible ,tb的技术还是很强啊。*/
    function refreshRem(_designWidth, _rem2px) {
      /*
       修改viewport后,对网页宽度的影响,会立刻反应到
       document.documentElement.getBoundingClientRect().width
       而这个改变反应到 window.innerWidth ,需要等较长的时间
       相应的对高度的反应,
       document.documentElement.getBoundingClientRect().height
       要稍微慢点,没有准确的数据,应该会受到机器的影响。
      */
      var width;
      if (isMob) {
        width = docEl.getBoundingClientRect().width;
      } else {
        /*默认当为普通了浏览器,就给宽度是800像素*/
        width = 800;
        var style = document.createElement('style');
        style.textContent = '.pc-wrapper{max-width:800px;margin:0 auto;}';
        document.head.appendChild(style);
      }
      /**/
      document.documentElement.style.fontSize = (width * _rem2px * 100) / _designWidth / 16 + '%';
    }

    /* 延时,让浏览器处理完viewport造成的影响,然后再计算root font-size。*/
    setTimeout(function () {
      refreshRem(designWidth, rem2px);
    }, 1);

  })(750, 100);
</script>


text:
package gcat

import (
	"github.com/jslyzt/gocat/ccat"
)

// Config 配置
type Config struct {
	EncoderType     int
	EnableHeartbeat int
	EnableSampling  int
	EnableDebugLog  int
}

// DefaultConfig 默认配置
func DefaultConfig() Config {
	return Config{ ENCoderBinary, 1, 1, 0, }
}

// DefaultConfigForCat2 cat2默认配置
func DefaultConfigForCat2() Config {
	return Config{ ENCoderText, 1, 0, 0, }
}

// Init 初始化
func Init(domain string, configs ...Config) {
	var config Config;
	if len(configs) > 1 {
		panic("Only 1 config can be specified while initializing cat.")
	} else if len(configs) == 1 {
		config = configs[0]
	} else {
		config = DefaultConfig()
	}

	ccat.InitWithConfig(domain, ccat.BuildConfig(
		config.EncoderType,
		config.EnableHeartbeat,
		config.EnableSampling,
		config.EnableDebugLog,
	))

	go ccat.Background()
}

// Shutdown 关闭
func Shutdown() {
	ccat.Shutdown()
}

// Wait 等待
func Wait() {
	ccat.Wait()
}


text:
<?php

declare(strict_types = 1);

namespace Saber\Data\IOption {

	use \Saber\Core;
	use \Saber\Data\IInt32;
	use \Saber\Data\IOption;

	/**
	 * @group ModuleTest
	 */
	final class ModuleTest extends Core\ModuleTest {

		#region Methods -> Basic Operations

		/**
		 * This method tests the "iterator" method.
		 */
		public function test_iterator() {
			$p0 = IOption\Type::some(IInt32\Type::zero());
			$e0 = array(0);

			$this->assertInstanceOf('\\Saber\\Data\\IOption\\Some\\Type', $p0);
			$this->assertSame(count($e0), $p0->__size());

			$p1 = IOption\Module::iterator($p0);
			$e1 = 0;

			$this->assertInstanceOf('\\Saber\\Data\\IOption\\Iterator', $p1);

			foreach ($p1 as $i => $item) {
				$this->assertInstanceOf('\\Saber\\Data\\IInt32\\Type', $i);
				$this->assertSame($e1, $i->unbox());
				$this->assertInstanceOf('\\Saber\\Core\\Type', $item);
				$this->assertSame($e0[$e1], $item->unbox());
				$e1++;
			}
		}

		#endregion

		#region Methods -> Conversion Operations

		#endregion

		#region Methods -> Equality Operations

		#endregion

		#region Methods -> Ordering Operations

		#endregion

	}

}


text:
package ru.job4j.condition;

import org.junit.Test;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

public class PointTest {
	@Test
	public void DotOnFunction() {
	Point pointa = new Point(0, 0);
	Point pointb = new Point(0, 5);
	double result = pointa.distanceTo(pointb);
	double expect = 5D;
	assertThat(result, is(expect));
	}

	@Test
	public void FubctionTest() {
	int a = 5;
	int b = 7;
	Point pointx = new Point(0, 1);
	boolean result = pointx.is(5, 7);
	boolean expect = false;
	assertThat(result, is(expect));
	}
}


text:
import React from 'react';

const SelectOption = ({
  name
}) => (
  <option
    value={name}
  >{name}</option>
);

export default SelectOption;


text:
import theano
import theano.tensor as T
import numpy as np

from util import *
from layer import *
from graph_state import GraphState, GraphStateSpec
from base_gru import BaseGRULayer

class PropagationTransformation( object ):
    """
    Transforms a graph state by propagating info across the graph
    """
    def __init__(self, transfer_size, graph_spec, transfer_activation=identity, dropout_keep=1):
        """
        Params:
            transfer_size: Integer, how much to transfer
            graph_spec: Instance of GraphStateSpec giving graph spec
            transfer_activation: Activation function to use during transfer
        """
        self._transfer_size = transfer_size
        self._transfer_activation = transfer_activation
        self._graph_spec = graph_spec
        self._process_input_size = graph_spec.num_node_ids + graph_spec.node_state_size

        self._transfer_stack = LayerStack(self._process_input_size, 2 * graph_spec.num_edge_types * transfer_size, activation=self._transfer_activation, name="propagation_transfer", dropout_keep=dropout_keep, dropout_input=False, dropout_output=True)
        self._propagation_gru = BaseGRULayer(graph_spec.num_node_ids + self._transfer_size, graph_spec.node_state_size, name="propagation", dropout_keep=dropout_keep, dropout_input=False, dropout_output=True)

    @property
    def params(self):
        return self._propagation_gru.params +  self._transfer_stack.params

    def dropout_masks(self, srng, state_mask=None):
        return self._transfer_stack.dropout_masks(srng) + self._propagation_gru.dropout_masks(srng, use_output=state_mask)

    def split_dropout_masks(self, dropout_masks):
        transfer_used, dropout_masks = self._transfer_stack.split_dropout_masks(dropout_masks)
        gru_used, dropout_masks = self._propagation_gru.split_dropout_masks(dropout_masks)
        return (transfer_used+gru_used), dropout_masks

    def process(self, gstate, dropout_masks=Ellipsis):
        """
        Process a graph state.
          1. Data is transfered from each node to each other node along both forward and backward edges.
                This data is processed with a Wx+b style update, and an optional transformation is applied
          2. Nodes sum the transfered data, weighted by the existence of the other node and the edge.
          3. Nodes perform a GRU update with this input

        Params:
            gstate: A GraphState giving the current state
        """
        if dropout_masks is Ellipsis:
            dropout_masks = None
            append_masks = False
        else:
            append_masks = True

        node_obs = T.concatenate([gstate.node_ids, gstate.node_states],2)
        flat_node_obs = node_obs.reshape([-1, self._process_input_size])
        transformed, dropout_masks = self._transfer_stack.process(flat_node_obs,dropout_masks)
        transformed = transformed.reshape([gstate.n_batch, gstate.n_nodes, 2*self._graph_spec.num_edge_types, self._transfer_size])
        scaled_transformed = transformed * T.shape_padright(T.shape_padright(gstate.node_strengths))
        # scaled_transformed is of shape (n_batch, n_nodes, 2*num_edge_types, transfer_size)
        # We want to multiply  through by edge strengths, which are of shape
        # (n_batch, n_nodes, n_nodes, num_edge_types), both fwd and backward
        edge_strength_scale = T.concatenate([gstate.edge_strengths, gstate.edge_strengths.swapaxes(1,2)], 3)
        # edge_strength_scale is of (n_batch, n_nodes, n_nodes, 2*num_edge_types)
        intermed = T.shape_padaxis(scaled_transformed, 2) * T.shape_padright(edge_strength_scale)
        # intermed is of shape (n_batch, n_nodes "source", n_nodes "dest", 2*num_edge_types, transfer_size)
        # now reduce along the "source" and "edge_types" dimensions to get dest activations
        # of shape (n_batch, n_nodes, transfer_size)
        reduced_result = T.sum(T.sum(intermed, 3), 1)

        # now add information fom current node id
        full_input = T.concatenate([gstate.node_ids, reduced_result], 2)

        # we flatten to apply GRU
        flat_input = full_input.reshape([-1, self._graph_spec.num_node_ids + self._transfer_size])
        flat_state = gstate.node_states.reshape([-1, self._graph_spec.node_state_size])
        new_flat_state, dropout_masks = self._propagation_gru.step(flat_input, flat_state, dropout_masks)

        new_node_states = new_flat_state.reshape(gstate.node_states.shape)

        new_gstate = gstate.with_updates(node_states=new_node_states)
        if append_masks:
            return new_gstate, dropout_masks
        else:
            return new_gstate

    def process_multiple(self, gstate, iterations, dropout_masks=Ellipsis):
        """
        Run multiple propagagtion steps.

        Params:
            gstate: A GraphState giving the current state
            iterations: An integer. How many steps to propagate
        """
        if dropout_masks is Ellipsis:
            dropout_masks = None
            append_masks = False
        else:
            append_masks = True

        def _scan_step(cur_node_states, node_strengths, node_ids, edge_strengths, *dmasks):
            curstate = GraphState(node_strengths, node_ids, cur_node_states, edge_strengths)
            newstate, _ = self.process(curstate, dmasks if dropout_masks is not None else None)
            return newstate.node_states

        outputs_info = [gstate.node_states]
        used_dropout_masks, dropout_masks = self.split_dropout_masks(dropout_masks)
        all_node_states, _ = theano.scan(_scan_step, n_steps=iterations, non_sequences=[gstate.node_strengths, gstate.node_ids, gstate.edge_strengths] + used_dropout_masks, outputs_info=outputs_info)

        final_gstate = gstate.with_updates(node_states=all_node_states[-1,:,:,:])
        if append_masks:
            return final_gstate, dropout_masks
        else:
            return final_gstate


text:
Imports BioNovoGene.Analytical.MassSpectrometry.Assembly.mzData.mzWebCache

Namespace MsImaging

    Public MustInherit Class Correction

        Public MustOverride Function GetPixelRowX(scanMs1 As ScanMS1) As Integer

    End Class
End Namespace


text:
<?php

namespace Thapp\XmlConf\Console;

use Illuminate\Console\Command;
use Illuminate\Container\Container;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;

/**
 * Class: XmlConfWarmupCommand
 *
 * @uses Command
 *
 * @package
 * @version
 * @author Thomas Appel <mail@thomas-appel.com>
 * @license MIT
 */
class XmlConfWarmupCommand extends Command
{
    /**
     * config
     *
     * @var array
     */
    protected $config;

    /**
     * container
     *
     * @var Illuminate\Container\Container
     */
    protected $container;

    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'xmlconf:warmup';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Warmup configuration cache.';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct(Container $container, $conf)
    {
        $this->config    = $conf;
        $this->container = $container;

        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function fire()
    {
        foreach ($this->config as $reader => $namesapce) {

            try {

                $reader = $this->container['xmlconf.' . $reader];
                $reader->load();

            } catch (\Exception $e) {

                $this->error($e->getMessage());

            }
        }

        $this->info('cache warmup ran successfully');
    }
}


text:
package org.efaps.ci;

/**
 * TODO comment!
 *
 * @author The eFaps Team
 *
 */
// CHECKSTYLE:OFF
public class CIAdminUser
{

    public static final _Abstract Abstract = new _Abstract("4c3e33a2-a024-4bb7-b857-69886bce7132");

    public static class _Abstract
        extends CIType
    {

        protected _Abstract(final String _uuid)
        {
            super(_uuid);
        }

        public final CIAttribute Name = new CIAttribute(this, "Name");
        public final CIAttribute Note = new CIAttribute(this, "Note");
        public final CIAttribute UUID = new CIAttribute(this, "UUID");
        public final CIAttribute RevisionLink = new CIAttribute(this, "RevisionLink");
        public final CIAttribute Status = new CIAttribute(this, "Status");
        public final CIAttribute Creator = new CIAttribute(this, "Creator");
        public final CIAttribute Created = new CIAttribute(this, "Created");
        public final CIAttribute Modifier = new CIAttribute(this, "Modifier");
        public final CIAttribute Modified = new CIAttribute(this, "Modified");
    }

    public static final _Abstract2Abstract _Abstract2Abstract = new _Abstract2Abstract("1ded9229-3daa-4c27-8e2a-175e5760470b");

    public static class _Abstract2Abstract
        extends CIType
    {

        protected _Abstract2Abstract(final String _uuid)
        {
            super(_uuid);
        }

        public final CIAttribute UserJAASSystem = new CIAttribute(this, "UserJAASSystem");
        public final CIAttribute UserFromAbstractLink = new CIAttribute(this, "UserFromAbstractLink");
        public final CIAttribute UserToAbstractLink = new CIAttribute(this, "UserToAbstractLink");
        public final CIAttribute Creator = new CIAttribute(this, "Creator");
        public final CIAttribute Created = new CIAttribute(this, "Created");
        public final CIAttribute Modifier = new CIAttribute(this, "Modifier");
        public final CIAttribute Modified = new CIAttribute(this, "Modified");
    }

    public static final _Association Association = new _Association("f941d6f2-2554-421a-8c6e-c109067b1c22");

    public static class _Association
        extends CIType
    {

        protected _Association(final String _uuid)
        {
            super(_uuid);
        }

        public final CIAttribute RoleLink = new CIAttribute(this, "RoleLink");
        public final CIAttribute GroupLink = new CIAttribute(this, "GroupLink");
        public final CIAttribute Creator = new CIAttribute(this, "Creator");
        public final CIAttribute Created = new CIAttribute(this, "Created");
        public final CIAttribute Modifier = new CIAttribute(this, "Modifier");
        public final CIAttribute Modified = new CIAttribute(this, "Modified");
    }

    public static final _JAASKey JAASKey = new _JAASKey("0e7650c6-8ec3-4c63-b377-f3eb5fb85f16");

    public static class _JAASKey
        extends CIType
    {

        protected _JAASKey(final String _uuid)
        {
            super(_uuid);
        }

        public final CIAttribute Key = new CIAttribute(this, "Key");
        public final CIAttribute JAASSystemLink = new CIAttribute(this, "JAASSystemLink");
        public final CIAttribute UserLink = new CIAttribute(this, "UserLink");
        public final CIAttribute Creator = new CIAttribute(this, "Creator");
        public final CIAttribute Created = new CIAttribute(this, "Created");
        public final CIAttribute Modifier = new CIAttribute(this, "Modifier");
        public final CIAttribute Modified = new CIAttribute(this, "Modified");
    }

    public static final _Person Person = new _Person("fe9d94fd-2ed8-4c44-b1f0-00e150555888");

    public static class _Person
        extends _Abstract
    {

        protected _Person(final String _uuid)
        {
            super(_uuid);
        }

        public final CIAttribute FirstName = new CIAttribute(this, "FirstName");
        public final CIAttribute LastName = new CIAttribute(this, "LastName");
        public final CIAttribute TimeZone = new CIAttribute(this, "TimeZone");
        public final CIAttribute Chronology = new CIAttribute(this, "Chronology");
        public final CIAttribute Language = new CIAttribute(this, "Language");
        public final CIAttribute Locale = new CIAttribute(this, "Locale");
        public final CIAttribute EmailSet = new CIAttribute(this, "EmailSet");
        public final CIAttribute Password = new CIAttribute(this, "Password");
        public final CIAttribute LastLogin = new CIAttribute(this, "LastLogin");
        public final CIAttribute LoginTry = new CIAttribute(this, "LoginTry");
        public final CIAttribute LoginTriesCounter = new CIAttribute(this, "LoginTriesCounter");
    }

    public static final _Group Group = new _Group("f5e1e2ff-bfa9-40d9-8340-a259f48d5ad9");

    public static class _Group
        extends _Abstract
    {
        protected _Group(final String _uuid)
        {
            super(_uuid);
        }
    }

    public static final _Company Company = new _Company("6a5388e9-7f7f-4bc0-b7a0-3245302faad5");

    public static class _Company
        extends _Abstract
    {
        protected _Company(final String _uuid)
        {
            super(_uuid);
        }
    }

    public static final _Consortium Consortium = new _Consortium("e517a0b6-8452-4eb6-b106-22bcad24add4");

    public static class _Consortium
        extends _Abstract
    {
        protected _Consortium(final String _uuid)
        {
            super(_uuid);
        }
    }

    public static final _RoleAbstract RoleAbstract = new _RoleGlobal("2f970c5c-41be-444f-b129-e6779e24c3fa");

    public static class _RoleAbstract
        extends _Abstract
    {
        protected _RoleAbstract(final String _uuid)
        {
            super(_uuid);
        }
    }

    public static final _RoleGlobal RoleGlobal = new _RoleGlobal("fe9d94fd-2ed8-4c44-b1f0-00e150555888");

    public static class _RoleGlobal
        extends _RoleAbstract
    {
        protected _RoleGlobal(final String _uuid)
        {
            super(_uuid);
        }
    }

    public static final _RoleLocal RoleLocal = new _RoleLocal("ae62fa23-6f5d-40e7-b1aa-d977fa4f188d");

    public static class _RoleLocal
        extends _RoleAbstract
    {
        protected _RoleLocal(final String _uuid)
        {
            super(_uuid);
        }
    }

    public static final _Person2Role Person2Role = new _Person2Role("37deb6ae-3e1c-4642-8823-715120386fc3");

    public static class _Person2Role
        extends _Abstract2Abstract
    {

        protected _Person2Role(final String _uuid)
        {
            super(_uuid);
        }

        public final CIAttribute UserFromLink = new CIAttribute(this, "UserFromLink");
        public final CIAttribute UserToLink = new CIAttribute(this, "UserToLink");

    }

    public static final _Person2Group Person2Group = new _Person2Group("fec64148-a39b-4f69-bedd-c3bcfe8e1602");

    public static class _Person2Group
        extends _Abstract2Abstract
    {

        protected _Person2Group(final String _uuid)
        {
            super(_uuid);
        }

        public final CIAttribute UserFromLink = new CIAttribute(this, "UserFromLink");
        public final CIAttribute UserToLink = new CIAttribute(this, "UserToLink");

    }

    public static final _Person2Company Person2Company = new _Person2Company("a79898fb-966a-44ee-a338-d034e2aad83a");

    public static class _Person2Company
        extends _Abstract2Abstract
    {

        protected _Person2Company(final String _uuid)
        {
            super(_uuid);
        }

        public final CIAttribute UserLink = new CIAttribute(this, "UserLink");
        public final CIAttribute CompanyLink = new CIAttribute(this, "CompanyLink");

    }

    public static final _AttributeAbstract AttributeAbstract = new _AttributeAbstract("d9dd0971-0bb9-4ac1-ba46-8aefd5e8badb");

    public static class _AttributeAbstract
        extends CIType
    {

        protected _AttributeAbstract(final String _uuid)
        {
            super(_uuid);
        }
        public final CIAttribute Creator = new CIAttribute(this, "Creator");
        public final CIAttribute Created = new CIAttribute(this, "Created");
        public final CIAttribute Modifier = new CIAttribute(this, "Modifier");
        public final CIAttribute Modified = new CIAttribute(this, "Modified");
    }

}


text:
define([
    "dojo/_base/kernel",
    "dojo/request/script",
    "dojo/_base/declare",
    "dojo/dom-geometry",
    "dojo/_base/array",
    "dojo/_base/lang",
    "dojo/_base/event",
    "dojo/io-query",
    "esri/InfoTemplate",
    "esri/layers/FeatureLayer",
    "esri/tasks/QueryTask",
    "esri/geometry/Extent",
    "esri/geometry/mathUtils",
    "esri/geometry/webMercatorUtils",
    "esri/geometry/Point",
    "esri/request",
    "esri/graphic",
    "esri/symbols/PictureMarkerSymbol",
    "dojo/date/locale",
    "dojo/on"
],
function (dojo, script, declare, domGeom, arr, lang, event, ioQuery, InfoTemplate, FeatureLayer, QueryTask, Extent, mathUtils, webMercatorUtils, Point, esriRequest, Graphic, PictureMarkerSymbol, locale, on) {
    var Widget = declare("modules.twitter", null, {
        constructor: function (options) {
            var _self = this;
            this.options = {
                url: "",
                filterUsers: [],
                filterWords: [],
                autopage: true,
                maxpage: 2,
                limit: 100,
                title: '',
                id: 'twitter',
                datePattern: "MMM d, yyyy",
                timePattern: "h:mma",
                searchTerm: '',
                symbolUrl: '',
                symbolHeight: 22.5,
                symbolWidth: 18.75,
                popupHeight: 200,
                popupWidth: 290,
                result_type: 'recent'
            };
            declare.safeMixin(this.options, options);
            if (this.options.map === null) {
                throw 'Reference to esri.Map object required';
            }
            this.featureCollection = {
                layerDefinition: {
                    "geometryType": "esriGeometryPoint",
                    "drawingInfo": {
                        "renderer": {
                            "type": "simple",
                            "symbol": {
                                "type": "esriPMS",
                                "url": this.options.symbolUrl,
                                "contentType": "image/" + this.options.symbolUrl.substring(this.options.symbolUrl.lastIndexOf(".") + 1),
                                "width": this.options.symbolWidth,
                                "height": this.options.symbolHeight
                            }
                        }
                    },
                    "fields": [{
                        "name": "OBJECTID",
                        "type": "esriFieldTypeOID"
                    }, {
                        "name": "smType",
                        "type": "esriFieldTypeString",
                        "alias": "smType",
                        "length": 100
                    }, {
                        "name": "created_at",
                        "type": "esriFieldTypeDate",
                        "alias": "Created"
                    }, {
                        "name": "id",
                        "type": "esriFieldTypeString",
                        "alias": "id",
                        "length": 100
                    }, {
                        "name": "from_user",
                        "type": "esriFieldTypeString",
                        "alias": "User",
                        "length": 100
                    }, {
                        "name": "location",
                        "type": "esriFieldTypeString",
                        "alias": "Location",
                        "length": 1073741822
                    }, {
                        "name": "place",
                        "type": "esriFieldTypeString",
                        "alias": "Place",
                        "length": 100
                    }, {
                        "name": "text",
                        "type": "esriFieldTypeString",
                        "alias": "Text",
                        "length": 1073741822
                    }, {
                        "name": "profile_image_url",
                        "type": "esriFieldTypeString",
                        "alias": "ProfileImage",
                        "length": 255
                    }],
                    "globalIdField": "id",
                    "displayField": "from_user"
                },
                featureSet: {
                    "features": [],
                    "geometryType": "esriGeometryPoint"
                }
            };
            this.infoTemplate = new InfoTemplate();
            this.infoTemplate.setTitle(function () {
                return _self.options.title;
            });
            this.infoTemplate.setContent(function (graphic) {
                return _self.getWindowContent(graphic, _self);
            });
            script.get(location.protocol + '//platform.twitter.com/widgets.js', {}).then(function () {}, function (err) {
                console.log(err.toString());
            });
            this.featureLayer = new FeatureLayer(this.featureCollection, {
                id: this.options.id,
                outFields: ["*"],
                infoTemplate: this.infoTemplate,
                visible: true
            });
            this.options.map.addLayer(this.featureLayer);
            var deferred;
            on(this.featureLayer, "click", lang.hitch(this, function (evt) {
                event.stop(evt);
                var query = new QueryTask();
                query.geometry = this.pointToExtent(this.options.map, evt.mapPoint, this.options.symbolWidth);
                deferred = this.featureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW);
                this.options.map.infoWindow.setFeatures([deferred]);
                dojo.showInfoWindow = true;
                setTimeout(function () { _self.options.map.infoWindow.show(evt.graphic.geometry); }, 500);
                this.adjustPopupSize(this.options.map);
            }));
            this.stats = {
                geoPoints: 0,
                geoNames: 0,
                noGeo: 0
            };
            this.dataPoints = [];
            this.deferreds = [];
            this.geocoded_ids = {};
            this.loaded = true;
            on(window, "resize", lang.hitch(this, function (evt) {
                event.stop(evt);
                this.adjustPopupSize(this.options.map);
            }));
        },
        update: function (options) {
            declare.safeMixin(this.options, options);
            this.constructQuery(this.options.searchTerm);
        },
        pointToExtent: function (map, point, toleranceInPixel) {
            var pixelWidth = map.extent.getWidth() / map.width;
            var toleraceInMapCoords = toleranceInPixel * pixelWidth;
            return new Extent(point.x - toleraceInMapCoords, point.y - toleraceInMapCoords, point.x + toleraceInMapCoords, point.y + toleraceInMapCoords, map.spatialReference);
        },
        getStats: function () {
            var x = this.stats;
            x.total = this.stats.geoPoints + this.stats.noGeo + this.stats.geoNames;
            return x;
        },
        parseURL: function (text) {
            return text.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&~\?\/.=]+/g, function (url) {
                return '' + url + '';
            });
        },
        parseUsername: function (text) {
            return text.replace(/[@]+[A-Za-z0-9-_]+/g, function (u) {
                var username = u.replace("@", "");
                return '' + u + '';
            });
        },
        parseHashtag: function (text) {
            return text.replace(/[#]+[A-Za-z0-9-_]+/g, function (t) {
                var tag = t.replace("#", "%23");
                return '' + t + '';
            });
        },
        getPoints: function () {
            return this.dataPoints;
        },
        clear: function () {
            // cancel any outstanding requests
            this.query = null;
            arr.forEach(this.deferreds, function (def) {
                def.cancel();
            });
            if (this.deferreds) {
                this.deferreds.length = 0;
            }
            // remove existing tweets
            if (this.options.map.infoWindow.isShowing) {
                this.options.map.infoWindow.hide();
            }
            if (this.featureLayer.graphics.length > 0) {
                this.featureLayer.applyEdits(null, null, this.featureLayer.graphics);
            }
            // clear stats and points
            this.stats = {
                geoPoints: 0,
                noGeo: 0,
                geoNames: 0
            };
            this.dataPoints = [];
            this.geocoded_ids = {};
            this.onClear();
        },
        show: function () {
            this.featureLayer.setVisibility(true);
        },
        hide: function () {
            this.featureLayer.setVisibility(false);
        },
        setVisibility: function (val) {
            if (val) {
                this.show();
            } else {
                this.hide();
            }
        },
        // Format Date Object
        formatDate: function (dateObj) {
            var _self = this;
            if (dateObj) {
                return locale.format(dateObj, {
                    datePattern: _self.options.timePattern,
                    selector: "date"
                }).toLowerCase() + ' · ' + locale.format(dateObj, {
                    datePattern: _self.options.datePattern,
                    selector: "date"
                });
            }
        },
        adjustPopupSize: function(map) {
            var box = domGeom.getContentBox(map.container);
            var width = 270, height = 300, // defaults
            newWidth = Math.round(box.w * 0.60),
            newHeight = Math.round(box.h * 0.45);
            if (newWidth < width) {
                width = newWidth;
            }
            if (newHeight < height) {
                height = newHeight;
            }
            map.infoWindow.resize(width, height);
        },
        getRadius: function () {
            var map = this.options.map;
            var extent = map.extent;
            this.maxRadius = 932;
            var radius = Math.min(this.maxRadius, Math.ceil(mathUtils.getLength(Point(extent.xmin, extent.ymin, map.spatialReference), Point(extent.xmax, extent.ymin, map.spatialReference)) * 3.281 / 5280 / 2));
            radius = Math.round(radius, 0);
            var geoPoint = webMercatorUtils.webMercatorToGeographic(extent.getCenter());
            return {
                radius: radius,
                center: geoPoint,
                units: "mi"
            };
        },
        getWindowContent: function (graphic, _self) {
            var tmp = dojo.locale.split('-');
            var loc = 'en';
            if (tmp[0]) {
                loc = tmp[0];
            }
            var date = new Date(graphic.attributes.created_at);
            var linkedText = _self.parseURL(graphic.attributes.text);
            linkedText = _self.parseUsername(linkedText);
            linkedText = _self.parseHashtag(linkedText);
            // define content for the tweet pop-up window.
            var html = '';
            html += '
';
            if (graphic.attributes.user.profile_image_url) {
                var imageURL;
                if (location.protocol === "https:") {
                    imageURL = graphic.attributes.user.profile_image_url_https;
                } else {
                    imageURL = graphic.attributes.user.profile_image_url;
                }
                html += '';
            }
            html += '

';
            html += '
' + graphic.attributes.user.name + '
';
            html += '
@' + graphic.attributes.user.screen_name + '
';
            html += '

';
            html += '
' + linkedText + '
';
            var d = this.formatDate(date) || '';
            if (graphic.attributes.created_at) {
                html += '
' + d + '
';
            }
            html += '
';
            html += ' ';
            html += ' ';
            html += ' ';
            html += '
';
            html += '
';
            return html;
        },
        constructQuery: function (searchValue) {
            var radius = this.getRadius();
            var search = lang.trim(searchValue);
            if (search.length === 0) {
                search = "";
            }
            var loc = false;
            var localeTmp = dojo.locale.split('-');
            if (localeTmp[0]) {
                loc = localeTmp[0];
            }
            this.query = {
                q: search,
                count: this.options.limit,
                result_type: this.options.result_type,
                include_entities: false,
                geocode: radius.center.y + "," + radius.center.x + "," + radius.radius + radius.units
            };
            if (loc) {
                this.query.locale = loc;
            }
            // start Twitter API call of several pages
            this.pageCount = 1;
            this.sendRequest(this.options.url + "?" + ioQuery.objectToQuery(this.query));
        },
        authenticate: function(){},
        unauthenticate: function(){},
        sendRequest: function (url) {
            var _self = this;
            // get the results from twitter for each page
            var deferred = esriRequest({
                url: url,
                handleAs: "json",
                timeout: 10000,
                callbackParamName: "callback",
                preventCache: true,
                load: lang.hitch(this, function (data) {
                    if(data.errors && data.errors.length > 0){
                        var errors = data.errors;
                        // each error
                        for(var i = 0; i < errors.length; i++){
                            // auth error
                            if(errors[i].code === 215){
                                console.log(errors);
                                _self.onUpdateEnd();
                                _self.authenticated = false;
                            }
                        }
                    }
                    else if(data && data.signedIn === false){
                        _self.authenticate();
                        _self.onUpdateEnd();
                        _self.authenticated = false;
                    }
                    else if (data.statuses && data.statuses.length > 0) {
                        if(!_self.authenticated){
                            _self.authenticated = true;
                            _self.unauthenticate();
                        }
                        this.mapResults(data);
                        // display results for multiple pages
                        if ((this.options.autopage) && (this.options.maxpage > this.pageCount) && (data.search_metadata.next_results) && (this.query)) {
                            this.pageCount++;
                            this.sendRequest(this.options.url + data.search_metadata.next_results);
                        } else {
                            this.onUpdateEnd();
                        }
                    } else {
                        // No results found, try another search term
                        this.onUpdateEnd();
                        _self.authenticated = true;
                    }
                }),
                error: lang.hitch(this, function (e) {
                    if (deferred.canceled) {
                        console.log('Search Cancelled');
                    } else {
                        console.log('Search error' + ": " + e.message.toString());
                    }
                    this.onError(e);
                })
            });
            this.deferreds.push(deferred);
        },
        unbindDef: function (dfd) {
            // if deferred has already finished, remove from deferreds array
            var index = arr.indexOf(this.deferreds, dfd);
            if (index === -1) {
                return; // did not find
            }
            this.deferreds.splice(index, 1);
            if (!this.deferreds.length) {
                return 2; // indicates we received results from all expected deferreds
            }
            return 1; // found and removed
        },
        findWordInText: function (word, text) {
            if (word && text) {
                // text
                var searchString = text.toLowerCase();
                // word
                var badWord = ' ' + word.toLowerCase() + ' ';
                // IF FOUND
                if (searchString.indexOf(badWord) > -1) {
                    return true;
                }
            }
            return false;
        },
        mapResults: function (j) {
            var _self = this;
            if (j.error) {
                console.log('Search error' + ": " + j.error.toString());
                this.onError(j.error);
                return;
            }
            var b = [];
            var k = j.statuses;
            arr.forEach(k, lang.hitch(this, function (result) {
                result.smType = this.options.id;
                result.filterType = 2;
                result.filterContent = 'https://twitter.com/#!/' + result.user.id_str + '/status/' + result.id_str;
                result.filterAuthor = result.user.id_str;
                // eliminate Tweets which we have on the map
                if (this.geocoded_ids[result.id]) {
                    return;
                }
                // filter variable
                var filter = false,
                    i;
                // check for filterd user
                if (_self.options.filterUsers && _self.options.filterUsers.length) {
                    for (i = 0; i < _self.options.filterUsers.length; i++) {
                        if (_self.options.filterUsers[i].toString() === result.user.id_str.toString()) {
                            filter = true;
                            break;
                        }
                    }
                }
                // check if contains bad word
                if (!filter && _self.options.filterWords && _self.options.filterWords.length) {
                    for (i = 0; i < _self.options.filterWords.length; i++) {
                        if (_self.findWordInText(_self.options.filterWords[i], result.text)) {
                            filter = true;
                            break;
                        }
                    }
                }
                // if this feature needs to be filtered
                if (filter) {
                    return;
                }
                this.geocoded_ids[result.id] = true;
                var geoPoint = null;
                if (result.geo) {
                    var g = result.geo.coordinates;
                    geoPoint = Point(parseFloat(g[1]), parseFloat(g[0]));
                } else {
                    var n = result.location;
                    if (n) {
                        var c, d, e, f;
                        // try some different parsings for result.location
                        if (n.indexOf("iPhone:") > -1) {
                            n = n.slice(7);
                            f = n.split(",");
                            geoPoint = Point(parseFloat(f[1]), parseFloat(f[0]));
                        } else if (n.indexOf("ÜT") > -1) {
                            n = n.slice(3);
                            e = n.split(",");
                            geoPoint = Point(parseFloat(e[1]), parseFloat(e[0]));
                        } else if (n.indexOf("T") === 1) {
                            n = n.slice(3);
                            e = n.split(",");
                            geoPoint = Point(parseFloat(e[1]), parseFloat(e[0]));
                        } else if (n.indexOf("Pre:") > -1) {
                            n = n.slice(4);
                            d = n.split(",");
                            geoPoint = Point(parseFloat(d[1]), parseFloat(d[0]));
                        } else if (n.split(",").length === 2) {
                            c = n.split(",");
                            if (c.length === 2 && parseFloat(c[1]) && parseFloat(c[0])) {
                                geoPoint = Point(parseFloat(c[1]), parseFloat(c[0]));
                            } else {
                                // location cannot be interpreted by this geocoder
                                this.stats.geoNames++;
                                return;
                            }
                        } else {
                            // location cannot be interpreted by this geocoder
                            this.stats.geoNames++;
                            return;
                        }
                    } else {
                        // location cannot be interpreted by this geocoder
                        this.stats.geoNames++;
                        return;
                    }
                }
                if (geoPoint) {
                    // last check to make sure we parsed it right
                    if (isNaN(geoPoint.x) || isNaN(geoPoint.y) || (parseInt(geoPoint.x, 10) === 0 && parseInt(geoPoint.y, 10) === 0)) {
                        //discard bad geopoints
                        this.stats.noGeo++;
                    } else {
                        // convert the Point to WebMercator projection
                        var a = new webMercatorUtils.geographicToWebMercator(geoPoint);
                        // make the Point into a Graphic
                        var graphic = new Graphic(a);
                        graphic.setAttributes(result);
                        b.push(graphic);
                        this.dataPoints.push({
                            geometry: {
                                x: a.x,
                                y: a.y
                            },
                            symbol: PictureMarkerSymbol(this.featureCollection.layerDefinition.drawingInfo.renderer.symbol),
                            attributes: result
                        });
                        this.stats.geoPoints++;
                    }
                } else {
                    this.stats.noGeo++;
                }
            }));
            this.featureLayer.applyEdits(b, null, null);
            this.onUpdate();
        },
        onUpdate: function () {},
        onUpdateEnd: function () {
            this.query = null;
        },
        onClear: function () {},
        onError: function () {
            this.onUpdateEnd();
        }
    });
    return Widget;
});