text:
package com.gemstone.gemfire.internal.admin;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import com.gemstone.gemfire.DataSerializer;
import com.gemstone.gemfire.admin.internal.AdminDistributedSystemImpl;
import com.gemstone.gemfire.distributed.internal.DistributionManager;
import com.gemstone.gemfire.distributed.internal.PooledDistributionMessage;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;

/**
 * A PooledDistributionMessage for notifying admin members about changes in
 * Client Membership received through BridgeMembership
 *
 * @author abhishek
 */
public class ClientMembershipMessage extends PooledDistributionMessage {
  public static final int JOINED  = 0;
  public static final int LEFT    = 1;
  public static final int CRASHED = 2;

  private String clientId;
  private String clientHost;
  private int    eventType;

  /**
   * Default constructor(for serialization)
   */
  public ClientMembershipMessage() {
  }

  /**
   * Parameterized constructor
   *
   * @param clientId
   *          Id of the client
   * @param clientHost
   *          host the client was running on (could be null)
   * @param eventType
   *          whether client joined, left or crashed. Should be one of
   *          ClientMembershipMessage.JOINED, ClientMembershipMessage.LEFT,
   *          ClientMembershipMessage.CRASHED
   */
  public ClientMembershipMessage(String clientId, String clientHost,
                                 int eventType) {
    this.clientId   = clientId;
    this.clientHost = clientHost;
    this.eventType  = eventType;
  }

  /**
   *
   * @see com.gemstone.gemfire.distributed.internal.DistributionMessage#process(com.gemstone.gemfire.distributed.internal.DistributionManager)
   */
  @Override
  protected void process(DistributionManager dm) {
    AdminDistributedSystemImpl adminDs =
                      AdminDistributedSystemImpl.getConnectedInstance();

    /*
     * Disconnect can be called on AdminDistributedSystem from Agent and it is
     * not synchronous with processing of this message. Null check added to
     * avoid null if disconnect has been called on AdminDistributedSystem
     */
    if (adminDs != null) {
      String senderId = null;
      InternalDistributedMember msgSender = this.getSender();
      if (msgSender != null) {
        senderId = msgSender.getId();
      }

      adminDs.processClientMembership(senderId, clientId,
                                      clientHost, eventType);
    }
  }

  /**
   *
   * @see com.gemstone.gemfire.internal.DataSerializableFixedID#getDSFID()
   */
  public int getDSFID() {
    return CLIENT_MEMBERSHIP_MESSAGE;
  }

  @Override
  public void toData(DataOutput out) throws IOException {
    super.toData(out);
    DataSerializer.writeString(this.clientId, out);
    DataSerializer.writeString(this.clientHost, out);
    out.writeInt(this.eventType);
  }

  @Override
  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
    super.fromData(in);

    this.clientId   = DataSerializer.readString(in);
    this.clientHost = DataSerializer.readString(in);
    this.eventType  = in.readInt();
  }

  /**
   * @return the clientId
   */
  public String getClientId() {
    return clientId;
  }

  /**
   * @return the clientHost
   */
  public String getClientHost() {
    return clientHost;
  }

  /**
   * @return the eventType
   */
  public int getEventType() {
    return eventType;
  }

  /**
   * @param eventType the eventType integer
   * @return String format of eventType
   */
  public static String getEventTypeString(int eventType) {
    switch (eventType) {
      case JOINED:
        return "Member JOINED";
      case LEFT:
        return "Member LEFT";
      case CRASHED:
        return "Member CRASHED";
      default:
        return "UNKNOWN";
    }
  }

  /**
   * String representation of this message.
   *
   * @return String representation of this message.
   */
  @Override
  public String toString() {
    String clientMembership = "JOINED";

    switch (this.eventType) {
    case LEFT:
      clientMembership = "LEFT";
      break;

    case CRASHED:
      clientMembership = "CRASHED and left";
      break;

    default:
      break;
    }

    return "Client with Id: "+this.clientId +
           " running on host: "+this.clientHost +
           " "+clientMembership +
           " the server: "+this.getSender();
  }

}


text:
<?php

if ( ! function_exists('image_url'))
{
	/**
	 * Asset image helper.
	 *
	 * @param  string  $image
	 * @return string
	 */
	function image_url($image)
	{
		return Assets::image($image);
	}
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef BEETL_REALIGNCORRECTIONS_HH
#define BEETL_REALIGNCORRECTIONS_HH

#endif //ifndef BEETL_REALIGNCORRECTIONS_HH


text:
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
		<title>index</title>

		<script src="../../dist/Creap.all.min.js"></script>

		<script src="test.js?1494297215211"></script>
		<script>
			var test = new Creap.Content('lib', 'test', 'images', 'ss');
			test.createJson();
		</script>
		<script>
			document.addEventListener('DOMContentLoaded', function() {
				var creap = new Creap.Application(test, document.body, {
					width: window.innerWidth,
					googleFont: {
						families: ["Alegreya","Gloria Hallelujah"]
					}
				}).on('initialized', function() {
					this.fullScreen();
					this.start();
				});
			}, false);
		</script>
	</head>
	<body style="margin:0px; overflow: hidden;">
	</body>
</html>


text:
{-# LANGUAGE FlexibleContexts #-}

--------------------------------------------------------------------------------
-- |
-- Module      : Network.OpenID.Utils
-- Copyright   : (c) Trevor Elliott, 2008
-- License     : BSD3
--
-- Maintainer  :
-- Stability   :
-- Portability :
--

module Network.OpenID.Utils (
    -- * General Helpers
    readMaybe
  , breaks
  , split
  , roll
  , unroll
  , btwoc

    -- * OpenID Defaults
  , defaultModulus
  , openidNS

    -- * MonadLib helpers
  , readM
  , lookupParam
  , readParam
  , withResponse
  ) where

-- friends
import Network.OpenID.Types

-- libraries
import Data.Bits
import Data.List
import Data.Word
import MonadLib
import Network.HTTP
import Network.Stream

-- General Helpers -------------------------------------------------------------

-- | Read, maybe.
readMaybe :: Read a => String -> Maybe a
readMaybe str = case reads str of
  [(x,"")] -> Just x
  _        -> Nothing

-- | Break up a string by a predicate.
breaks :: (a -> Bool) -> [a] -> [[a]]
breaks p xs = case break p xs of
  (as,_:bs) -> as : breaks p bs
  (as,_)    -> [as]

-- | Spit a list into a pair, removing the element that caused the predicate to
--   succeed.
split :: (a -> Bool) -> [a] -> ([a],[a])
split p as = case break p as of
  (xs,_:ys) -> (xs,ys)
  pair      -> pair

-- | Build an Integer out of a big-endian list of bytes.
roll :: [Word8] -> Integer
roll  = foldr step 0 . reverse
  where step n acc = acc `shiftL` 8 .|. fromIntegral n

-- | Turn an Integer into a big-endian list of bytes
unroll :: Integer -> [Word8]
unroll = reverse . unfoldr step
  where
    step 0 = Nothing
    step i = Just (fromIntegral i, i `shiftR` 8)

-- | Pad out a list of bytes to represent a positive, big-endian list of bytes.
btwoc :: [Word8] -> [Word8]
btwoc [] = [0x0]
btwoc bs@(x:_) | testBit x 7 = 0x0 : bs
               | otherwise   =       bs

-- OpenID Defaults -------------------------------------------------------------

-- | The OpenID-2.0 namespace.
openidNS :: String
openidNS  = "http://specs.openid.net/auth/2.0"

-- | Default modulus for Diffie-Hellman key exchange.
defaultModulus :: Integer
defaultModulus  = 0xDCF93A0B883972EC0E19989AC5A2CE310E1D37717E8D9571BB7623731866E61EF75A2E27898B057F9891C2E27A639C3F29B60814581CD3B2CA3986D2683705577D45C2E7E52DC81C7A171876E5CEA74B1448BFDFAF18828EFD2519F14E45E3826634AF1949E5B535CC829A483B8A76223E5D490A257F05BDFF16F2FB22C583AB

-- MonadLib Helpers ------------------------------------------------------------

-- | Read inside of an Exception monad
readM :: (ExceptionM m e, Read a) => e -> String -> m a
readM e str = case reads str of
  [(x,"")] -> return x
  _        -> raise e

-- | Lookup parameters inside an exception handling monad
lookupParam :: ExceptionM m Error => String -> Params -> m String
lookupParam k ps = maybe err return (lookup k ps)
  where err = raise $ Error $ "field not present: " ++ k

-- | Read a field
readParam :: (Read a, ExceptionM m Error) => String -> Params -> m a
readParam k ps = readM err =<< lookupParam k ps
  where err = Error ("unable to read field: " ++ k)

-- | Make an HTTP request, and run a function with a successful response
withResponse :: ExceptionM m Error
             => Either ConnError (Response String) -> (Response String -> m a) -> m a
withResponse (Left  err) _ = raise $ Error $ show err
withResponse (Right rsp) f = f rsp


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/popularCaptionTextView"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginLeft="10dp"
        android:layout_marginStart="10dp"/>

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/popularImageView"
        android:adjustViewBounds="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="8dp"
        android:layout_below="@+id/popularCaptionTextView" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/likeButton"
        android:text="@string/like_picture"
        android:layout_below="@+id/popularImageView"
        android:layout_marginTop="8dp"
        android:layout_centerHorizontal="true"
        android:enabled="true"/>

</RelativeLayout>


text:
<?php

namespace Drupal\metatag_twitter_cards\Plugin\metatag\Tag;

use Drupal\metatag\Plugin\metatag\Tag\MetaNameBase;

/**
 * The Twitter Cards app id for iphone metatag.
 *
 * @MetatagTag(
 *   id = "twitter_cards_app_id_iphone",
 *   label = @Translation("iPhone app ID"),
 *   description = @Translation("String value, should be the numeric representation of your iPhone app's ID in the App Store."),
 *   name = "twitter:app:id:iphone",
 *   group = "twitter_cards",
 *   weight = 302,
 *   type = "string",
 *   secure = FALSE,
 *   multiple = FALSE
 * )
 */
class TwitterCardsAppIdIphone extends MetaNameBase {
}


text:
package org.apache.hyracks.storage.am.lsm.invertedindex.util;

import java.util.ArrayList;

import org.apache.hyracks.storage.am.lsm.invertedindex.api.IObjectFactory;

public class ObjectCache<T> {
    protected final int expandSize;
    protected final IObjectFactory<T> objFactory;
    protected final ArrayList<T> cache;
    protected int lastReturned = 0;

    public ObjectCache(IObjectFactory<T> objFactory, int initialSize, int expandSize) {
        this.objFactory = objFactory;
        this.cache = new ArrayList<T>(initialSize);
        this.expandSize = expandSize;
        expand(initialSize);
    }

    private void expand(int expandSize) {
        for (int i = 0; i < expandSize; i++) {
            cache.add(objFactory.create());
        }
    }

    public void reset() {
        lastReturned = 0;
    }

    public T getNext() {
        if (lastReturned >= cache.size()) {
            expand(expandSize);
        }
        return cache.get(lastReturned++);
    }
}


text:
package mutationoperators.methodlevel.exco;

import mutationoperators.MutationOperator;
import mutationoperators.TwoASTMatcher;

import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;

import utils.JDT_Utils;

public class EXCO_Update_Matcher extends TwoASTMatcher {

	public EXCO_Update_Matcher(MutationOperator mutop) {
		super(mutop);
	}

	@Override
	public boolean match(SingleVariableDeclaration node, Object other) {
		// if the compared AST is no SingleVariableDeclaration,
		// we cannot compare them
		if(!(other instanceof SingleVariableDeclaration)){
			return false;
		}
		SingleVariableDeclaration node2 = (SingleVariableDeclaration) other;

		// check if both values have the same variable name
		boolean sameVariableName = node.getName().subtreeMatch(defaultMatcher, node2.getName());

		// retrieve the Bindings of both types
		ITypeBinding firstBinding = node.getType().resolveBinding();
		ITypeBinding secondBinding = node2.getType().resolveBinding();

		// check if these are compatible types, so one type is the parent of the other one
		boolean isCompatible = JDT_Utils.isTypeParentOfOtherType(firstBinding, secondBinding) || JDT_Utils.isTypeParentOfOtherType(secondBinding, firstBinding);

		// if all conditions are true, we have a match
		if(sameVariableName && isCompatible){
			this.mutop.found(node, node2);
			return false;
		}

		return false;
	}

}


text:
using namespace BloombergLP;

//=============================================================================
//                                TEST PLAN
//-----------------------------------------------------------------------------
//                                Overview
//                                --------
// The component under test defines two meta-functions, 'bsl::is_class' and
// 'bslmf::IsClass', that determine whether a template parameter type is a
// class type.  Thus, we need to ensure that the values returned by these
// meta-functions are correct for each possible category of types.  Since the
// two meta-functions are functionally equivalent, we will use the same set of
// types for both.
//
//-----------------------------------------------------------------------------
// PUBLIC CLASS DATA
// [ 2] bslmf::IsClass::VALUE
// [ 1] bsl::is_class::value
//
// ----------------------------------------------------------------------------
// [ 3] USAGE EXAMPLE

//=============================================================================
//                  STANDARD BDE ASSERT TEST MACRO
//-----------------------------------------------------------------------------
static int testStatus = 0;

void aSsErT(bool b, const char *s, int i)
{
    if (b) {
        printf("Error " __FILE__ "(%d): %s    (failed)\n", i, s);
        if (testStatus >= 0 && testStatus <= 100) ++testStatus;
    }
}

#define ASSERT(X) { aSsErT(!(X), #X, __LINE__); }

//=============================================================================
//                       STANDARD BDE TEST DRIVER MACROS
//-----------------------------------------------------------------------------
#define LOOP_ASSERT  BSLS_BSLTESTUTIL_LOOP_ASSERT
#define LOOP2_ASSERT BSLS_BSLTESTUTIL_LOOP2_ASSERT
#define LOOP3_ASSERT BSLS_BSLTESTUTIL_LOOP3_ASSERT
#define LOOP4_ASSERT BSLS_BSLTESTUTIL_LOOP4_ASSERT
#define LOOP5_ASSERT BSLS_BSLTESTUTIL_LOOP5_ASSERT
#define LOOP6_ASSERT BSLS_BSLTESTUTIL_LOOP6_ASSERT

#define Q   BSLS_BSLTESTUTIL_Q   // Quote identifier literally.
#define P   BSLS_BSLTESTUTIL_P   // Print identifier and value.
#define P_  BSLS_BSLTESTUTIL_P_  // P(X) without '\n'.
#define T_  BSLS_BSLTESTUTIL_T_  // Print a tab (w/o newline).
#define L_  BSLS_BSLTESTUTIL_L_  // current Line number

//=============================================================================
//                  GLOBAL TYPEDEFS/CONSTANTS FOR TESTING
//-----------------------------------------------------------------------------

namespace {

enum EnumTestType {
    // This user-defined 'enum' type is intended to be used for testing as the
    // template parameter 'TYPE' of 'bsl::is_class'.
};

struct StructTestType {
    // This user-defined 'struct' type is intended to be used for testing as
    // the template parameter 'TYPE' of 'bsl::is_class'.
};

union UnionTestType {
    // This user-defined 'union' type is intended to be used for testing as the
    // template parameter 'TYPE' of 'bsl::is_class'.
};

class BaseClassTestType {
    // This user-defined base class type is intended to be used for testing as
    // the template parameter 'TYPE' of 'bsl::is_class'.
};

class DerivedClassTestType : public BaseClassTestType {
    // This user-defined derived class type is intended to be used for testing
    // as the template parameter 'TYPE' of 'bsl::is_class'.
};

typedef int (StructTestType::*MethodPtrTestType) ();
    // This pointer to non-static member function type is intended to be used
    // for testing as the template parameter 'TYPE' of 'bsl::is_class'.

typedef void (*FunctionPtrTestType) ();
    // This function pointer type is intended to be used for testing as the
    // template parameter 'TYPE' of 'bsl::is_class'.

typedef int StructTestType::*PMD;
    // This pointer to member object type is intended to be used for testing as
    // the template parameter 'TYPE' of 'bsl::is_class'.

struct Incomplete;
    // This incomplete 'struct' type is intended to be used for testing as the
    // template parameter 'TYPE' of 'bsl::is_class'.

}  // close unnamed namespace

#define TYPE_ASSERT_CVQ_PREFIX(META_FUNC, TYPE, result)       \
    ASSERT(result == META_FUNC<TYPE>::value);                 \
    ASSERT(result == META_FUNC<const TYPE>::value);           \
    ASSERT(result == META_FUNC<volatile TYPE>::value);        \
    ASSERT(result == META_FUNC<const volatile TYPE>::value);

#define TYPE_ASSERT_CVQ_SUFFIX(META_FUNC, TYPE, result)       \
    ASSERT(result == META_FUNC<TYPE>::value);                 \
    ASSERT(result == META_FUNC<TYPE const>::value);           \
    ASSERT(result == META_FUNC<TYPE volatile>::value);        \
    ASSERT(result == META_FUNC<TYPE const volatile>::value);

#define TYPE_ASSERT_CVQ_REF(META_FUNC, TYPE, result)           \
    ASSERT(result == META_FUNC<TYPE&>::value);                 \
    ASSERT(result == META_FUNC<TYPE const&>::value);           \
    ASSERT(result == META_FUNC<TYPE volatile&>::value);        \
    ASSERT(result == META_FUNC<TYPE const volatile&>::value);

#define TYPE_ASSERT_CVQ(META_FUNC, TYPE, result)                     \
    TYPE_ASSERT_CVQ_PREFIX(META_FUNC, TYPE, result);                 \
    TYPE_ASSERT_CVQ_PREFIX(META_FUNC, TYPE const, result);           \
    TYPE_ASSERT_CVQ_PREFIX(META_FUNC, TYPE volatile, result);        \
    TYPE_ASSERT_CVQ_PREFIX(META_FUNC, TYPE const volatile, result);  \

//=============================================================================
//                              USAGE EXAMPLES
//-----------------------------------------------------------------------------

///Usage
///-----
// In this section we show intended use of this component.
//
///Example 1: Verify Class Types
///- - - - - - - - - - - - - - -
// Suppose that we want to assert whether a set of types are class types.
//
// First, we create a class type 'MyClass':
//..
    class MyClass
    {
    };
//..

//=============================================================================
//                              MAIN PROGRAM
//-----------------------------------------------------------------------------

int main(int argc, char *argv[])
{
    int test = argc > 1 ? atoi(argv[1]) : 0;
    int verbose = argc > 2;
    // int veryVerbose = argc > 3;

    printf("TEST " __FILE__ " CASE %d\n", test);

    switch (test) { case 0:  // Zero is always the leading case.
      case 3: {
        // --------------------------------------------------------------------
        // USAGE EXAMPLE
        //
        // Concerns:
        //: 1 The usage example provided in the component header file compiles,
        //:   links, and runs as shown.
        //
        // Plan:
        //: 1 Incorporate usage example from header into test driver, remove
        //:   leading comment characters, and replace 'assert' with 'ASSERT'.
        //:   (C-1)
        //
        // Testing:
        //   USAGE EXAMPLE
        // --------------------------------------------------------------------

        if (verbose) printf("USAGE EXAMPLE\n"
                            "=============\n");

// Now, we instantiate the 'bsl::is_class' template for both a non-class type
// and the defined type 'MyClass', and assert the 'value' static data member of
// each instantiation:
//..
    ASSERT(false == bsl::is_class<int>::value);
    ASSERT(true  == bsl::is_class<MyClass>::value);
//..

      } break;
      case 2: {
        // --------------------------------------------------------------------
        // 'bslmf::IsClass::VALUE'
        //   Ensure that the static data member 'VALUE' of 'bslmf::IsClass'
        //   instantiations having various (template parameter) 'TYPE's has the
        //   correct value.
        //
        // Concerns:
        //: 1 'IsClass::VALUE' is 0 when 'TYPE' is a (possibly cv-qualified)
        //:   primitive type.
        //:
        //: 2 'IsClass::VALUE' is 0 when 'TYPE' is a (possibly cv-qualified)
        //:   'enum' type.
        //:
        //: 3 'IsClass::VALUE' is 1 when 'TYPE' is a (possibly cv-qualified)
        //:   'class', 'struct', or 'union' type.
        //:
        //: 4 'IsClass::VALUE' is 0 when 'TYPE' is a (possibly cv-qualified)
        //:   pointer or pointer-to-member type.
        //:
        //: 5 'IsClass::VALUE' is 0 when 'TYPE' is a (possibly cv-qualified)
        //:   function type.
        //
        // Plan:
        //   Verify that 'bslmf::IsClass::VALUE' has the correct value for each
        //   (template parameter) 'TYPE' in the concerns.
        //
        // Testing:
        //   bslmf::IsClass::VALUE
        // --------------------------------------------------------------------

        if (verbose) printf("'bslmf::IsClass::VALUE'\n"
                            "=======================\n");

        // C-1
        TYPE_ASSERT_CVQ_SUFFIX(bslmf::IsClass, void, 0);
        TYPE_ASSERT_CVQ_SUFFIX(bslmf::IsClass, int,  0);
        TYPE_ASSERT_CVQ_REF   (bslmf::IsClass, int,  0);

        // C-2
        TYPE_ASSERT_CVQ_SUFFIX(bslmf::IsClass, EnumTestType, 0);

        // C-3
        TYPE_ASSERT_CVQ_SUFFIX(bslmf::IsClass, StructTestType,       1);
        TYPE_ASSERT_CVQ_REF   (bslmf::IsClass, StructTestType,       0);
        TYPE_ASSERT_CVQ_SUFFIX(bslmf::IsClass, UnionTestType,        1);
        TYPE_ASSERT_CVQ_REF   (bslmf::IsClass, UnionTestType,        0);
        TYPE_ASSERT_CVQ_SUFFIX(bslmf::IsClass, Incomplete,           1);
        TYPE_ASSERT_CVQ_REF   (bslmf::IsClass, Incomplete,           0);
        TYPE_ASSERT_CVQ_SUFFIX(bslmf::IsClass, BaseClassTestType,    1);
        TYPE_ASSERT_CVQ_REF   (bslmf::IsClass, BaseClassTestType,    0);
        TYPE_ASSERT_CVQ_SUFFIX(bslmf::IsClass, DerivedClassTestType, 1);
        TYPE_ASSERT_CVQ_REF   (bslmf::IsClass, DerivedClassTestType, 0);

        // C-4
        TYPE_ASSERT_CVQ(bslmf::IsClass, int*,                       0);
        TYPE_ASSERT_CVQ(bslmf::IsClass, StructTestType*,            0);
        TYPE_ASSERT_CVQ(bslmf::IsClass, int StructTestType::*,      0);
        TYPE_ASSERT_CVQ(bslmf::IsClass, int StructTestType::* *,    0);
        TYPE_ASSERT_CVQ(bslmf::IsClass, UnionTestType*,             0);
        TYPE_ASSERT_CVQ(bslmf::IsClass, PMD BaseClassTestType::*,   0);
        TYPE_ASSERT_CVQ(bslmf::IsClass, PMD BaseClassTestType::* *, 0);
        TYPE_ASSERT_CVQ(bslmf::IsClass, BaseClassTestType*,         0);
        TYPE_ASSERT_CVQ(bslmf::IsClass, DerivedClassTestType*,      0);
        TYPE_ASSERT_CVQ(bslmf::IsClass, Incomplete*,                0);
        TYPE_ASSERT_CVQ_SUFFIX(bslmf::IsClass, MethodPtrTestType,   0);
        TYPE_ASSERT_CVQ_SUFFIX(bslmf::IsClass, FunctionPtrTestType, 0);

        TYPE_ASSERT_CVQ_REF(bslmf::IsClass, int*,                       0);
        TYPE_ASSERT_CVQ_REF(bslmf::IsClass, StructTestType*,            0);
        TYPE_ASSERT_CVQ_REF(bslmf::IsClass, int StructTestType::*,      0);
        TYPE_ASSERT_CVQ_REF(bslmf::IsClass, int StructTestType::* *,    0);
        TYPE_ASSERT_CVQ_REF(bslmf::IsClass, UnionTestType*,             0);
        TYPE_ASSERT_CVQ_REF(bslmf::IsClass, PMD BaseClassTestType::*,   0);
        TYPE_ASSERT_CVQ_REF(bslmf::IsClass, PMD BaseClassTestType::* *, 0);
        TYPE_ASSERT_CVQ_REF(bslmf::IsClass, BaseClassTestType*,         0);
        TYPE_ASSERT_CVQ_REF(bslmf::IsClass, DerivedClassTestType*,      0);
        TYPE_ASSERT_CVQ_REF(bslmf::IsClass, Incomplete*,                0);
        TYPE_ASSERT_CVQ_REF(bslmf::IsClass, MethodPtrTestType,          0);
        TYPE_ASSERT_CVQ_REF(bslmf::IsClass, FunctionPtrTestType,        0);

        // C-5
        TYPE_ASSERT_CVQ_PREFIX(bslmf::IsClass, int  (int),  0);
        TYPE_ASSERT_CVQ_PREFIX(bslmf::IsClass, void (void), 0);
        TYPE_ASSERT_CVQ_PREFIX(bslmf::IsClass, int  (void), 0);
        TYPE_ASSERT_CVQ_PREFIX(bslmf::IsClass, void (int),  0);
      } break;
      case 1: {
        // --------------------------------------------------------------------
        // 'bsl::is_class::value'
        //   Ensure that the static data member 'value' of 'bsl::is_class'
        //   instantiations having various (template parameter) 'TYPE's has the
        //   correct value.
        //
        // Concerns:
        //: 1 'is_class::value' is 'false' when 'TYPE' is a (possibly
        //:   cv-qualified) primitive type.
        //:
        //: 2 'is_class::value' is 'false' when 'TYPE' is a (possibly
        //:   cv-qualified) 'enum' type.
        //:
        //: 3 'is_class::value' is 'true' when 'TYPE' is a (possibly
        //:   cv-qualified) 'class', 'struct', or 'union' type.
        //:
        //: 4 'is_class::value' is 'false' when 'TYPE' is a (possibly
        //:   cv-qualified) pointer or pointer-to-member type.
        //:
        //: 5 'is_class::value' is 'false' when 'TYPE' is a (possibly
        //:   cv-qualified) function type.
        //
        // Plan:
        //   Verify that 'bsl::is_class::value' has the correct value for
        //   each (template parameter) 'TYPE' in the concerns.
        //
        // Testing:
        //   bsl::is_class::value
        // --------------------------------------------------------------------

        if (verbose) printf("'bsl::is_class::value'\n"
                            "======================\n");

        // C-1
        TYPE_ASSERT_CVQ_SUFFIX(bsl::is_class, void, false);
        TYPE_ASSERT_CVQ_SUFFIX(bsl::is_class, int,  false);
        TYPE_ASSERT_CVQ_REF   (bsl::is_class, int,  false);

        // C-2
        TYPE_ASSERT_CVQ_SUFFIX(bsl::is_class, EnumTestType, false);

        // C-3
        TYPE_ASSERT_CVQ_SUFFIX(bsl::is_class, StructTestType,       true);
        TYPE_ASSERT_CVQ_REF   (bsl::is_class, StructTestType,       false);
        TYPE_ASSERT_CVQ_SUFFIX(bsl::is_class, UnionTestType,        true);
        TYPE_ASSERT_CVQ_REF   (bsl::is_class, UnionTestType,        false);
        TYPE_ASSERT_CVQ_SUFFIX(bsl::is_class, Incomplete,           true);
        TYPE_ASSERT_CVQ_REF   (bsl::is_class, Incomplete,           false);
        TYPE_ASSERT_CVQ_SUFFIX(bsl::is_class, BaseClassTestType,    true);
        TYPE_ASSERT_CVQ_REF   (bsl::is_class, BaseClassTestType,    false);
        TYPE_ASSERT_CVQ_SUFFIX(bsl::is_class, DerivedClassTestType, true);
        TYPE_ASSERT_CVQ_REF   (bsl::is_class, DerivedClassTestType, false);

        // C-4
        TYPE_ASSERT_CVQ(bsl::is_class, int*,                       false);
        TYPE_ASSERT_CVQ(bsl::is_class, StructTestType*,            false);
        TYPE_ASSERT_CVQ(bsl::is_class, int StructTestType::*,      false);
        TYPE_ASSERT_CVQ(bsl::is_class, int StructTestType::* *,    false);
        TYPE_ASSERT_CVQ(bsl::is_class, UnionTestType*,             false);
        TYPE_ASSERT_CVQ(bsl::is_class, PMD BaseClassTestType::*,   false);
        TYPE_ASSERT_CVQ(bsl::is_class, PMD BaseClassTestType::* *, false);
        TYPE_ASSERT_CVQ(bsl::is_class, BaseClassTestType*,         false);
        TYPE_ASSERT_CVQ(bsl::is_class, DerivedClassTestType*,      false);
        TYPE_ASSERT_CVQ(bsl::is_class, Incomplete*,                false);
        TYPE_ASSERT_CVQ_SUFFIX(bsl::is_class, MethodPtrTestType,   false);
        TYPE_ASSERT_CVQ_SUFFIX(bsl::is_class, FunctionPtrTestType, false);

        TYPE_ASSERT_CVQ_REF(bsl::is_class, int*,                       false);
        TYPE_ASSERT_CVQ_REF(bsl::is_class, StructTestType*,            false);
        TYPE_ASSERT_CVQ_REF(bsl::is_class, int StructTestType::*,      false);
        TYPE_ASSERT_CVQ_REF(bsl::is_class, int StructTestType::* *,    false);
        TYPE_ASSERT_CVQ_REF(bsl::is_class, UnionTestType*,             false);
        TYPE_ASSERT_CVQ_REF(bsl::is_class, PMD BaseClassTestType::*,   false);
        TYPE_ASSERT_CVQ_REF(bsl::is_class, PMD BaseClassTestType::* *, false);
        TYPE_ASSERT_CVQ_REF(bsl::is_class, BaseClassTestType*,         false);
        TYPE_ASSERT_CVQ_REF(bsl::is_class, DerivedClassTestType*,      false);
        TYPE_ASSERT_CVQ_REF(bsl::is_class, Incomplete*,                false);
        TYPE_ASSERT_CVQ_REF(bsl::is_class, MethodPtrTestType,          false);
        TYPE_ASSERT_CVQ_REF(bsl::is_class, FunctionPtrTestType,        false);

        // C-5
        TYPE_ASSERT_CVQ_PREFIX(bsl::is_class, int  (int),  false);
        TYPE_ASSERT_CVQ_PREFIX(bsl::is_class, void (void), false);
        TYPE_ASSERT_CVQ_PREFIX(bsl::is_class, int  (void), false);
        TYPE_ASSERT_CVQ_PREFIX(bsl::is_class, void (int),  false);
      } break;
      default: {
        fprintf(stderr, "WARNING: CASE `%d' NOT FOUND.\n", test);
        testStatus = -1;
      }
    }

    if (testStatus > 0) {
        fprintf(stderr, "Error, non-zero test status = %d.\n", testStatus);
    }
    return testStatus;
}

// ----------------------------------------------------------------------------
// Copyright 2013 Bloomberg Finance L.P.
//
// 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.
// ----------------------------- END-OF-FILE ----------------------------------


text:
{{post.title}}

 {{post.createdOn | date:'EEEE yyyy-MMMM-dd' | uppercase}}

Comments:

 {{comment.name}} {{comment.createdOn | date:'EEEE yyyy-MMMM-dd HH:mm'}}

                        Comment posted successfully

                        <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>

        <form class="form">

                    Name
                    <input type="text" class="form-control" id="name" placeholder="Name" ng-model="newComment.name">

                    Email
                    <input type="email" class="form-control" id="email" placeholder="Enter email"
                           ng-model="newComment.email">

                    <button type="submit" class="btn btn-primary" ng-click="createComment()">Submit</button>

        </form>


text:
A .NET portable class library that implements the [OWI-007 Robotic Arm parallel port protocol](http://notbrainsurgery.livejournal.com/38622.html). Tested on Windows 10 using [USB Controlled Robotic Arm Kit](http://www.maplin.co.uk/p/usb-controlled-robotic-arm-kit-a37jn)

## Release 1.5 ##

### Installing the robotic arm USB driver, under Windows

Before operating the arm, ensure that you have the correct USB driver installed. For instructions, see [how to install a usb driver for the owi robotic arm](https://myrobot.zone/blog/post/2016/04/29/how-to-install-a-usb-driver-for-the-owi-robotic-arm.aspx) page.

### Code snippet
The following code example demonstrates the API. It will at the same time and for 2 seconds, rotate the base clockwise, move the shoulder up and turn on the LED. After which all movement is stopped and the LED is turned off.

```csharp
IOwiFactory factory = new OwiFactory();
IOwiArm arm = factory.CreateArm(new LibUsbOwiConnection());

await arm.ConnectAsync();

IOwiCommand command = factory.CreateCommand().BaseRotateClockwise().ShoulderUp().LedOn();

await arm.SendCommandAsync(command);

Thread.Sleep(2000);

await arm.SendCommandAsync(command.StopAllMovements().LedOff());

await arm.DisconnectAsync();
```

### Nuget Package(s)
The library is available on nuget - [owi-arm-dotnet](https://www.nuget.org/packages/owi-arm-dotnet/).

For a Windows desktop usb implementation, refer to the sister package - [owi-arm-dotnet-usb](https://www.nuget.org/packages/owi-arm-dotnet-usb/).

### Sample application

The sample application can be used to access all of the robotic arm features via a basic user interface.

## Upgrading form Release 1.0 to 1.5

A number of breaking changes were made so please follow this guide if you are upgrading form 1.0 to 1.5.

1. Introduction of asynchronous API - Replace IOwiArm methods Connect(), SendCommand() and Disconnect() with ConnectAsync(), SendCommandAsync() and DisconnectAsync() respectively.
2. The implementation of IOwiUsbConnection was moved from lib-usb-dotnet to lib-usb-dotnet-usb, so add a reference to the latter project or use its respective nuget package.
3. Generally classes are now internal and only interfaces are public. To instantiate IOwiArm or IOwiCommand, use the OwiFactory (see code sample above).


text:
id: 56533eb9ac21ba0edf2244be
title: Global Scope and Functions
challengeType: 1
videoUrl: ''
localeTitle: Âmbito global e funções
---

## Description

 Em JavaScript, o <dfn>escopo</dfn> se refere à visibilidade das variáveis. Variáveis definidas fora de um bloco de funções possuem escopo <dfn>Global</dfn> . Isso significa que eles podem ser vistos em qualquer lugar no seu código JavaScript. As variáveis que são usadas sem a palavra-chave var são criadas automaticamente no escopo global . Isso pode criar consequências indesejadas em outro lugar no seu código ou ao executar uma função novamente. Você deve sempre declarar suas variáveis com var .

## Instructions

 Usando var , declare uma variável global myGlobal fora de qualquer função. Inicialize com um valor de 10 . Dentro da função fun1 , atribua 5 a oopsGlobal sem usar a palavra-chave var .

## Tests

```yml
tests:
  - text: <code>myGlobal</code> deve ser definido
    testString: 'assert(typeof myGlobal != "undefined", "<code>myGlobal</code> should be defined");'
  - text: <code>myGlobal</code> deve ter um valor de <code>10</code>
    testString: 'assert(myGlobal === 10, "<code>myGlobal</code> should have a value of <code>10</code>");'
  - text: <code>myGlobal</code> deve ser declarado usando a palavra-chave <code>var</code>
    testString: 'assert(/var\s+myGlobal/.test(code), "<code>myGlobal</code> should be declared using the <code>var</code> keyword");'
  - text: <code>oopsGlobal</code> deve ser uma variável global e ter um valor de <code>5</code>
    testString: 'assert(typeof oopsGlobal != "undefined" && oopsGlobal === 5, "<code>oopsGlobal</code> should be a global variable and have a value of <code>5</code>");'

```

## Challenge Seed

```js
// Declare your variable here

function fun1() {
  // Assign 5 to oopsGlobal Here

}

// Only change code above this line
function fun2() {
  var output = "";
  if (typeof myGlobal != "undefined") {
    output += "myGlobal: " + myGlobal;
  }
  if (typeof oopsGlobal != "undefined") {
    output += " oopsGlobal: " + oopsGlobal;
  }
  console.log(output);
}

```

### Before Test

```js
var logOutput = "";
var originalConsole = console
function capture() {
    var nativeLog = console.log;
    console.log = function (message) {
        logOutput = message;
        if(nativeLog.apply) {
          nativeLog.apply(originalConsole, arguments);
        } else {
          var nativeMsg = Array.prototype.slice.apply(arguments).join(' ');
          nativeLog(nativeMsg);
        }
    };
}

function uncapture() {
  console.log = originalConsole.log;
}
var oopsGlobal;
capture();

```

### After Test

```js
console.info('after the test');
```

## Solution

```js
// solution required
```


text:
/* global */
(function () {
    'use strict';

    function HomeCtrl() {

        this.msg = 'Hello HomeCtrl'
    }

    angular.module('<%= app_name %>')
        .controller('HomeCtrl', [
            '$scope',

            HomeCtrl
        ])

}());


text: TypeScript type definition search


text:
package scala.meta.testkit

import java.io.File

/**
 * A Scala source file taken from some Github repo
 *
 * @param filename
 *   Path to the file relative to the "target/repos" root directory.
 * @param projectUrl
 *   The url of the Github project containing this source file.
 * @param commit
 *   The commit has at where this ScalaFile originates from.
 */
case class CorpusFile(filename: String, projectUrl: String, commit: String) {

  /** Github "raw" url for this ScalaFile */
  def rawUrl: String = {
    val raw = projectUrl.replace("github.com", "raw.githubusercontent.com")
    s"$raw/$commit$filename"
  }

  /** File on local filesystem */
  def jFile: File =
    new File(FileOps.getFile("target", "repos", repo), filename)

  /** Read string contents of this ScalaFile. */
  def read: String = FileOps.readFile(jFile)

  /** Same as [[githubUrl]] but highlighted at a given line-number. */
  def githubUrlAtLine(line: Int): String = link(s"$githubUrl#L${line + 1}")

  /** Github url to non-raw (i.e., syntax highlighted) version of this ScalaFile */
  def githubUrl = s"$projectUrl/blob/$commit$filename"

  /** username/repo pair */
  def userRepo: String = projectUrl.stripPrefix("https://github.com/")

  /** repo in username/repo */
  def repo: String = userRepo.split("/")(1)

  /** username in username/repo */
  def user: String = userRepo.split("/")(0)

  override def toString: String = s"""ScalaFile(
                                     |    project: $user
                                     |    github: $githubUrl
                                     |    raw: $rawUrl
                                     |)""".stripMargin

  private def link(url: String) =
    s"[$repo/${url.replaceFirst(".*/", "")}]($url)"
}


text:
typedef std::map<std::string, int> count_map;  ///< Map words to counts
typedef count_map::value_type      count_pair; ///< pair of a word and a count
typedef std::string::size_type     str_size;   ///< String size type

void initialize_streams()
{
  std::cin.imbue(std::locale{});
  std::cout.imbue(std::locale{});
}

str_size get_longest_key(count_map const& map)
{
  str_size result{0};
  for (auto pair : map)
    if (pair.first.size() > result)
      result = pair.first.size();
  return result;
}

void print_pair(count_pair const& pair, str_size longest)
{
  int const count_size{10}; // Number of places for printing the count
  std::cout << std::setw(longest)    << std::left  << pair.first <<
               std::setw(count_size) << std::right << pair.second << '\n';
}

void print_counts(count_map counts)
{
  str_size longest{get_longest_key(counts)};

  // For each word/count pair...
  for (count_pair pair: counts)
    print_pair(pair, longest);
}

class function {
    public:
        function(std::locale loc)
            : ctype_{ std::use_facet<std::ctype<char>>(loc) } { }

        bool isalnum(char ch) const {
            return ctype_.is(std::ctype_base::alnum, ch);
        }

        char tolower(char ch) const {
            return ctype_.tolower(ch);
        }

    private:
        std::ctype<char> const& ctype_;
};

class sanitizer : public function {
    public:
        typedef std::string argument_type;
        typedef std::string result_type;

        sanitizer(std::locale loc) : function(loc) { }

        std::string operator()(std::string const& str) {
            std::string result{};
            for (char c: str)
                if (isalnum(c))
                    result.push_back(tolower(c));

            return result;
        }
};

int main() {
    std::locale::global(std::locale{ "" });
    initialize_streams();

    count_map counts{};

    std::string word{};
    sanitizer sanitize{ std::locale{} };
    while (std::cin >> word) {
        std::string copy{ sanitize(word) };
        if (not copy.empty())
            ++counts[copy];
    }

    print_counts(counts);

    return 0;
}


text:
using ILGPU;
using ILGPU.Runtime;
using System;
using VI.NumSharp.Drivers.Data.GPU;
using VI.ParallelComputing;

namespace VI.NumSharp.Drivers.Executor.GPU
{
    public partial class ParallelFloatExecutorGPU
    {
        public static void kernel_V_mult_V(Index pos, ArrayView<float> output, ArrayView<float> v0, ArrayView<float> v1)
        {
            int x = pos.X;
            output[x] = v0[x] * v1[x];
        }

        public static void kernel_V_div_V(Index pos, ArrayView<float> output, ArrayView<float> v0, ArrayView<float> v1)
        {
            int x = pos.X;
            output[x] = v0[x] / v1[x];
        }

        public static void kernel_V_sub_V(Index pos, ArrayView<float> output, ArrayView<float> v0, ArrayView<float> v1)
        {
            int x = pos.X;
            output[x] = v0[x] - v1[x];
        }

        public static void kernel_V_add_V(Index pos, ArrayView<float> output, ArrayView<float> v0, ArrayView<float> v1)
        {
            int x = pos.X;
            output[x] = v0[x] + v1[x];
        }

        public static void kernel_V_add_C(Index pos, ArrayView<float> output, ArrayView<float> v, float c)
        {
            int x = pos.X;
            output[x] = v[x] + c;
        }

        public static void kernel_V_mult_C(Index pos, ArrayView<float> output, ArrayView<float> v, float c)
        {
            int x = pos.X;
            output[x] = v[x] * c;
        }

        public static void kernel_V_sub_C(Index pos, ArrayView<float> output, ArrayView<float> v, float c)
        {
            int x = pos.X;
            output[x] = v[x] - c;
        }

        public static void kernel_C_sub_V(Index pos, ArrayView<float> output, float c, ArrayView<float> v)
        {
            int x = pos.X;
            output[x] = c - v[x];
        }

        public static void kernel_V_div_C(Index pos, ArrayView<float> output, ArrayView<float> v, float c)
        {
            int x = pos.X;
            output[x] = v[x] / c;
        }

        public static void kernel_C_div_V(Index pos, ArrayView<float> output, float c, ArrayView<float> v)
        {
            int x = pos.X;
            output[x] = c / v[x];
        }

        public static void kernel_V_ApplyMask(Index pos, ArrayView<float> output, ArrayView<float> arr, ArrayView<byte> mask)
        {
            int x = pos.X;
            output[x] = arr[x] * mask[x];
        }

        public static void kernel_V_Tanh(Index pos, ArrayView<float> output, ArrayView<float> arr)
        {
            int x = pos.X;
            output[x] = GPUMath.Tanh(arr[x]);
        }

        public static void kernel_V_Sin(Index pos, ArrayView<float> output, ArrayView<float> arr)
        {
            int x = pos.X;
            output[x] = GPUMath.Sin(arr[x]);
        }

        public static void kernel_V_Cos(Index pos, ArrayView<float> output, ArrayView<float> arr)
        {
            int x = pos.X;
            output[x] = GPUMath.Cos(arr[x]);
        }

        public static void kernel_V_Pow(Index pos, ArrayView<float> output, ArrayView<float> arr, float exp)
        {
            int x = pos.X;
            output[x] = GPUMath.Pow(arr[x], exp);
        }

        public static void kernel_V_Exp(Index pos, ArrayView<float> output, ArrayView<float> arr)
        {
            int x = pos.X;
            output[x] = GPUMath.Exp(arr[x]);
        }

        public static void kernel_V_Log(Index pos, ArrayView<float> output, ArrayView<float> arr)
        {
            int x = pos.X;
            output[x] = GPUMath.Log(arr[x]);
        }

        public static void kernel_V_Sqrt(Index pos, ArrayView<float> output, ArrayView<float> arr)
        {
            int x = pos.X;
            output[x] = GPUMath.Sqrt(arr[x]);
        }

        public static void kernel_VT_mult_M(Index2 pos, ArrayView2D<float> output, ArrayView<float> vt, ArrayView2D<float> m)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = vt[y] * m[x, y];
        }

        public static void kernel_M_mult_M(Index2 pos, ArrayView2D<float> output, ArrayView2D<float> m0, ArrayView2D<float> m1)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = m0[x, y] * m1[x, y];
        }

        public static void kernel_M_div_M(Index2 pos, ArrayView2D<float> output, ArrayView2D<float> m0, ArrayView2D<float> m1)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = m0[x, y] / m1[x, y];
        }

        public static void kernel_M_sub_M(Index2 pos, ArrayView2D<float> output, ArrayView2D<float> m0, ArrayView2D<float> m1)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = m0[x, y] - m1[x, y];
        }

        public static void kernel_M_add_M(Index2 pos, ArrayView2D<float> output, ArrayView2D<float> m0, ArrayView2D<float> m1)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = m0[x, y] + m1[x, y];
        }

        public static void kernel_M_mult_VT(Index2 pos, ArrayView2D<float> output, ArrayView2D<float> m, ArrayView<float> vt)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = m[x, y] * vt[y];
        }

        public static void kernel_M_mult_V(Index2 pos, ArrayView2D<float> output, ArrayView2D<float> m, ArrayView<float> v)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = m[x, y] * v[x];
        }

        public static void kernel_V_mult_M(Index2 pos, ArrayView2D<float> output, ArrayView<float> v, ArrayView2D<float> m)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = m[x, y] * v[x];
        }

        public static void kernel_M_mult_C(Index2 pos, ArrayView2D<float> output, ArrayView2D<float> m, float c)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = m[x, y] * c;
        }

        public static void kernel_M_add_C(Index2 pos, ArrayView2D<float> output, ArrayView2D<float> m, float c)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = m[x, y] + c;
        }

        public static void kernel_M_div_C(Index2 pos, ArrayView2D<float> output, ArrayView2D<float> m, float c)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = m[x, y] / c;
        }

        public static void kernel_C_div_M(Index2 pos, ArrayView2D<float> output, ArrayView2D<float> m, float c)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = c / m[x, y];
        }

        public static void kernel_IC_div_M(Index2 pos, ArrayView2D<float> output, ArrayView2D<float> m, int c)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = c / m[x, y];
        }

        public static void kernel_m_Sqrt(Index2 pos, ArrayView2D<float> output, ArrayView2D<float> arr)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = GPUMath.Sqrt(arr[x, y]);
        }

        public static void kernel_M_mult_MT(Index2 pos, ArrayView2D<float> output, ArrayView2D<float> m, ArrayView2D<float> mt)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = m[x, y] * mt[y, x];
        }

        public static void kernel_MT_mult_M(Index2 pos, ArrayView2D<float> output, ArrayView2D<float> mt, ArrayView2D<float> m)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = mt[y, x] * m[x, y];
        }

        public static void kernel_M_ApplyMask(Index2 pos, ArrayView2D<float> output, ArrayView2D<float> arr, ArrayView2D<byte> mask)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = arr[x, y] * mask[x, y];
        }

        public static void kernel_M_SumLine(Index2 pos, ArrayView2D<float> m, int r, int boxSize)
        {
            var x = pos.X;
            var y = pos.Y;
            m[x, y] = m[x, y] + m[x, y + r + boxSize];
        }

        public static void kernel_M_SumColumn(Index2 pos, ArrayView2D<float> m, int r, int boxSize)
        {
            var x = pos.X;
            var y = pos.Y;
            m[x, y] = m[x, y] + m[x + r + boxSize, y];
        }

        public static void kernel_M_2_lines_V(Index size, ArrayView<float> v, ArrayView2D<float> m)
        {
            int x = size.X;
            v[x] = m[x, 0] + m[x, 1];
        }

        public static void kernel_M_2_columns_V(Index size, ArrayView<float> v, ArrayView2D<float> m)
        {
            int y = size.X;
            v[y] = m[0, y] + m[1, y];
        }

        public static void kernel_VT_mult_V(Index2 pos, ArrayView2D<float> output, ArrayView<float> vt, ArrayView<float> v)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = vt[y] * v[x];
        }

        public static void kernel_V_mult_VT(Index2 pos, ArrayView2D<float> output, ArrayView<float> v, ArrayView<float> vt)
        {
            int x = pos.X;
            int y = pos.Y;
            output[x, y] = v[x] * vt[y];
        }
    }

    public partial class ParallelFloatExecutorGPU
    {
        private Action<Index, ArrayView<float>, ArrayView<float>, ArrayView<float>> _V_mult_V;
        private Action<Index, ArrayView<float>, ArrayView<float>, ArrayView<float>> _V_div_V;
        private Action<Index, ArrayView<float>, ArrayView<float>, ArrayView<float>> _V_sub_V;
        private Action<Index, ArrayView<float>, ArrayView<float>, ArrayView<float>> _V_add_V;
        private Action<Index, ArrayView<float>, ArrayView<float>, float> _V_add_C;
        private Action<Index, ArrayView<float>, ArrayView<float>, float> _V_mult_C;
        private Action<Index, ArrayView<float>, ArrayView<float>, float> _V_sub_C;
        private Action<Index, ArrayView<float>, float, ArrayView<float>> _C_sub_V;
        private Action<Index, ArrayView<float>, ArrayView<float>, float> _V_div_C;
        private Action<Index, ArrayView<float>, float, ArrayView<float>> _C_div_V;
        private Action<Index, ArrayView<float>, ArrayView<float>, ArrayView<byte>> _V_ApplyMask;
        private Action<Index, ArrayView<float>, ArrayView<float>> _V_Tanh;
        private Action<Index, ArrayView<float>, ArrayView<float>> _V_Sin;
        private Action<Index, ArrayView<float>, ArrayView<float>> _V_Cos;
        private Action<Index, ArrayView<float>, ArrayView<float>, float> _V_Pow;
        private Action<Index, ArrayView<float>, ArrayView<float>> _V_Exp;
        private Action<Index, ArrayView<float>, ArrayView<float>> _V_Log;
        private Action<Index, ArrayView<float>, ArrayView<float>> _V_Sqrt;
        private Action<Index2, ArrayView2D<float>, ArrayView<float>, ArrayView2D<float>> _VT_mult_M;
        private Action<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView2D<float>> _M_mult_M;
        private Action<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView2D<float>> _M_div_M;
        private Action<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView2D<float>> _M_sub_M;
        private Action<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView2D<float>> _M_add_M;
        private Action<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView<float>> _M_mult_VT;
        private Action<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView<float>> _M_mult_V;
        private Action<Index2, ArrayView2D<float>, ArrayView<float>, ArrayView2D<float>> _V_mult_M;
        private Action<Index2, ArrayView2D<float>, ArrayView2D<float>, float> _M_mult_C;
        private Action<Index2, ArrayView2D<float>, ArrayView2D<float>, float> _M_add_C;
        private Action<Index2, ArrayView2D<float>, ArrayView2D<float>, float> _M_div_C;
        private Action<Index2, ArrayView2D<float>, ArrayView2D<float>, float> _C_div_M;
        private Action<Index2, ArrayView2D<float>, ArrayView2D<float>, int> _IC_div_M;
        private Action<Index2, ArrayView2D<float>, ArrayView2D<float>> _m_Sqrt;
        private Action<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView2D<float>> _M_mult_MT;
        private Action<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView2D<float>> _MT_mult_M;
        private Action<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView2D<byte>> _M_ApplyMask;
        private Action<Index2, ArrayView2D<float>, int, int> _M_SumLine;
        private Action<Index2, ArrayView2D<float>, int, int> _M_SumColumn;
        private Action<Index, ArrayView<float>, ArrayView2D<float>> _M_2_lines_V;
        private Action<Index, ArrayView<float>, ArrayView2D<float>> _M_2_columns_V;
        private Action<Index2, ArrayView2D<float>, ArrayView<float>, ArrayView<float>> _VT_mult_V;
        private Action<Index2, ArrayView2D<float>, ArrayView<float>, ArrayView<float>> _V_mult_VT;

        public ParallelFloatExecutorGPU()
        {
            _V_mult_V = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView<float>, ArrayView<float>>(kernel_V_mult_V);
            _V_div_V = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView<float>, ArrayView<float>>(kernel_V_div_V);
            _V_sub_V = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView<float>, ArrayView<float>>(kernel_V_sub_V);
            _V_add_V = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView<float>, ArrayView<float>>(kernel_V_add_V);
            _V_add_C = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView<float>, float>(kernel_V_add_C);
            _V_mult_C = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView<float>, float>(kernel_V_mult_C);
            _V_sub_C = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView<float>, float>(kernel_V_sub_C);
            _C_sub_V = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, float, ArrayView<float>>(kernel_C_sub_V);
            _V_div_C = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView<float>, float>(kernel_V_div_C);
            _C_div_V = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, float, ArrayView<float>>(kernel_C_div_V);
            _V_ApplyMask = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView<float>, ArrayView<byte>>(kernel_V_ApplyMask);
            _V_Tanh = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView<float>>(kernel_V_Tanh);
            _V_Sin = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView<float>>(kernel_V_Sin);
            _V_Cos = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView<float>>(kernel_V_Cos);
            _V_Pow = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView<float>, float>(kernel_V_Pow);
            _V_Exp = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView<float>>(kernel_V_Exp);
            _V_Log = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView<float>>(kernel_V_Log);
            _V_Sqrt = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView<float>>(kernel_V_Sqrt);
            _VT_mult_M = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView<float>, ArrayView2D<float>>(kernel_VT_mult_M);
            _M_mult_M = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView2D<float>>(kernel_M_mult_M);
            _M_div_M = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView2D<float>>(kernel_M_div_M);
            _M_sub_M = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView2D<float>>(kernel_M_sub_M);
            _M_add_M = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView2D<float>>(kernel_M_add_M);
            _M_mult_VT = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView<float>>(kernel_M_mult_VT);
            _M_mult_V = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView<float>>(kernel_M_mult_V);
            _V_mult_M = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView<float>, ArrayView2D<float>>(kernel_V_mult_M);
            _M_mult_C = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView2D<float>, float>(kernel_M_mult_C);
            _M_add_C = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView2D<float>, float>(kernel_M_add_C);
            _M_div_C = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView2D<float>, float>(kernel_M_div_C);
            _C_div_M = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView2D<float>, float>(kernel_C_div_M);
            _IC_div_M = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView2D<float>, int>(kernel_IC_div_M);
            _m_Sqrt = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView2D<float>>(kernel_m_Sqrt);
            _M_mult_MT = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView2D<float>>(kernel_M_mult_MT);
            _MT_mult_M = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView2D<float>>(kernel_MT_mult_M);
            _M_ApplyMask = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView2D<float>, ArrayView2D<byte>>(kernel_M_ApplyMask);
            _M_SumLine = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, int, int>(kernel_M_SumLine);
            _M_SumColumn = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, int, int>(kernel_M_SumColumn);
            _M_2_lines_V = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView2D<float>>(kernel_M_2_lines_V);
            _M_2_columns_V = Device.CUDA.LoadAutoGroupedStreamKernel<Index, ArrayView<float>, ArrayView2D<float>>(kernel_M_2_columns_V);
            _VT_mult_V = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView<float>, ArrayView<float>>(kernel_VT_mult_V);
            _V_mult_VT = Device.CUDA.LoadAutoGroupedStreamKernel<Index2, ArrayView2D<float>, ArrayView<float>, ArrayView<float>>(kernel_V_mult_VT);
        }
    }

    public partial class ParallelFloatExecutorGPU : IFloatArrayExecutor
    {
        public IFloatData V_mult_V(IFloatData cache, IFloatData v0, IFloatData v1)
        {
            var size = v0.Length;
            _V_mult_V(size, cache.MemoryView, v0.MemoryView, v1.MemoryView);
            return cache;
        }

        public IFloatData V_div_V(IFloatData cache, IFloatData v0, IFloatData v1)
        {
            var size = v0.Length;
            _V_div_V(size, cache.MemoryView, v0.MemoryView, v1.MemoryView);
            return cache;
        }

        public IFloatData V_sub_V(IFloatData cache, IFloatData v0, IFloatData v1)
        {
            var size = v0.Length;
            _V_sub_V(size, cache.MemoryView, v0.MemoryView, v1.MemoryView);
            return cache;
        }

        public IFloatData V_add_V(IFloatData cache, IFloatData v0, IFloatData v1)
        {
            var size = v0.Length;
            _V_add_V(size, cache.MemoryView, v0.MemoryView, v1.MemoryView);
            return cache;
        }

        public IFloatData V_add_C(IFloatData cache, IFloatData v, float c)
        {
            var size = v.Length;
            _V_add_C(size, cache.MemoryView, v.MemoryView, c);
            return cache;
        }

        public IFloatData V_mult_C(IFloatData cache, IFloatData v, float c)
        {
            var size = v.Length;
            _V_mult_C(size, cache.MemoryView, v.MemoryView, c);
            return cache;
        }

        public IFloatData V_sub_C(IFloatData cache, IFloatData v, float c)
        {
            var size = v.Length;
            _V_sub_C(size, cache.MemoryView, v.MemoryView, c);
            return cache;
        }

        public IFloatData V_sub_C(IFloatData cache, float c, IFloatData v)
        {
            var size = v.Length;
            _V_sub_C(size, cache.MemoryView, v.MemoryView, c);
            return cache;
        }

        public IFloatData V_div_C(IFloatData cache, IFloatData v, float c)
        {
            var size = v.Length;
            _V_div_C(size, cache.MemoryView, v.MemoryView, c);
            return cache;
        }

        public IFloatData V_div_C(IFloatData cache, float c, IFloatData v)
        {
            var size = v.Length;
            _V_div_C(size, cache.MemoryView, v.MemoryView, c);
            return cache;
        }

        public IFloatData Tanh(IFloatData cache, IFloatData arr)
        {
            var size = arr.Length;
            _V_Tanh(size, cache.MemoryView, arr.MemoryView);
            return cache;
        }

        public IFloatData Sin(IFloatData cache, IFloatData arr)
        {
            var size = arr.Length;
            _V_Sin(size, cache.MemoryView, arr.MemoryView);
            return cache;
        }

        public IFloatData Cos(IFloatData cache, IFloatData arr)
        {
            var size = arr.Length;
            _V_Cos(size, cache.MemoryView, arr.MemoryView);
            return cache;
        }

        public IFloatData Pow(IFloatData cache, IFloatData arr, float exp)
        {
            var size = arr.Length;
            _V_Pow(size, cache.MemoryView, arr.MemoryView, exp);
            return cache;
        }

        public IFloatData Exp(IFloatData cache, IFloatData arr)
        {
            var size = arr.Length;
            _V_Exp(size, cache.MemoryView, arr.MemoryView);
            return cache;
        }

        public IFloatData Log(IFloatData cache, IFloatData arr)
        {
            var size = arr.Length;
            _V_Log(size, cache.MemoryView, arr.MemoryView);
            return cache;
        }

        public IFloatData Sqrt(IFloatData cache, IFloatData arr)
        {
            var size = arr.Length;
            _V_Sqrt(size, cache.MemoryView, arr.MemoryView);
            return cache;
        }

        public IFloatData2D VT_mult_M(IFloatData2D cache, IFloatData vt, IFloatData2D m)
        {
            var size = new Index2(m.W, m.H);
            _VT_mult_M(size, cache.MemoryView, vt.MemoryView, m.MemoryView);
            return cache;
        }

        public IFloatData2D M_mult_M(IFloatData2D cache, IFloatData2D m0, IFloatData2D m1)
        {
            var size = new Index2(m0.W, m0.H);
            _M_mult_M(size, cache.MemoryView, m0.MemoryView, m1.MemoryView);
            ProcessingDevice.FloatArrayDevice.Executor.Wait();
            return cache;
        }

        public IFloatData2D M_div_M(IFloatData2D cache, IFloatData2D m0, IFloatData2D m1)
        {
            var size = new Index2(m0.W, m0.H);
            _M_div_M(size, cache.MemoryView, m0.MemoryView, m1.MemoryView);
            return cache;
        }

        public IFloatData2D M_sub_M(IFloatData2D cache, IFloatData2D m0, IFloatData2D m1)
        {
            var size = new Index2(m0.W, m0.H);
            _M_sub_M(size, cache.MemoryView, m0.MemoryView, m1.MemoryView);
            return cache;
        }

        public IFloatData2D M_add_M(IFloatData2D cache, IFloatData2D m0, IFloatData2D m1)
        {
            var size = new Index2(m0.W, m0.H);
            _M_add_M(size, cache.MemoryView, m0.MemoryView, m1.MemoryView);
            return cache;
        }

        public IFloatData2D M_mult_VT(IFloatData2D cache, IFloatData2D m, IFloatData v)
        {
            var size = new Index2(m.W, m.H);
            _M_mult_VT(size, cache.MemoryView, m.MemoryView, v.MemoryView);
            return cache;
        }

        public IFloatData2D M_mult_V(IFloatData2D cache, IFloatData2D m, IFloatData v)
        {
            var size = new Index2(m.W, m.H);
            _M_mult_V(size, cache.MemoryView, m.MemoryView, v.MemoryView);
            return cache;
        }

        public IFloatData2D V_mult_M(IFloatData2D cache, IFloatData v, IFloatData2D m)
        {
            var size = new Index2(m.W, m.H);
            _V_mult_M(size, cache.MemoryView, v.MemoryView, m.MemoryView);
            return cache;
        }

        public IFloatData2D M_mult_C(IFloatData2D cache, IFloatData2D m, float c)
        {
            var size = new Index2(m.W, m.H);
            _M_mult_C(size, cache.MemoryView, m.MemoryView, c);
            return cache;
        }

        public IFloatData2D M_add_C(IFloatData2D cache, IFloatData2D m, float c)
        {
            var size = new Index2(m.W, m.H);
            _M_add_C(size, cache.MemoryView, m.MemoryView, c);
            return cache;
        }

        public IFloatData2D M_div_C(IFloatData2D cache, IFloatData2D m, float c)
        {
            var size = new Index2(m.W, m.H);
            _M_div_C(size, cache.MemoryView, m.MemoryView, c);
            return cache;
        }

        public IFloatData2D C_div_M(IFloatData2D cache, IFloatData2D m, float c)
        {
            var size = new Index2(m.W, m.H);
            _C_div_M(size, cache.MemoryView, m.MemoryView, c);
            return cache;
        }

        public IFloatData2D C_div_M(IFloatData2D cache, IFloatData2D m, int c)
        {
            var size = new Index2(m.W, m.H);
            _IC_div_M(size, cache.MemoryView, m.MemoryView, c);
            return cache;
        }

        public IFloatData2D Sqrt(IFloatData2D cache, IFloatData2D arr)
        {
            var size = new Index2(arr.W, arr.H);
            _m_Sqrt(size, cache.MemoryView, arr.MemoryView);
            return cache;
        }

        public IFloatData2D VT_mult_V(IFloatData vt, IFloatData v)
        {
            var size = new Index2(v.Length, vt.Length);
            var output = ILGPUMethods.Allocate<float>(size);
            _VT_mult_V(size, output.View, vt.MemoryView, v.MemoryView);
            return new GPU_FloatData2D(output);
        }

        public IFloatData2D V_mult_VT(IFloatData v, IFloatData vt)
        {
            var size = new Index2(v.Length, vt.Length);
            var output = ILGPUMethods.Allocate<float>(size);
            _V_mult_VT(size, output.View, v.MemoryView, vt.MemoryView);
            return new GPU_FloatData2D(output);
        }

        public IFloatData2D M_mult_MT(IFloatData2D m, IFloatData2D mt)
        {
            var size = new Index2(m.W, m.H);
            var output = ILGPUMethods.Allocate<float>(size);
            _M_mult_MT(size, output.View, m.MemoryView, mt.MemoryView);
            return new GPU_FloatData2D(output);
        }

        public IFloatData2D MT_mult_M(IFloatData2D mt, IFloatData2D m)
        {
            var size = new Index2(mt.H, mt.W);
            var output = ILGPUMethods.Allocate<float>(size);
            _MT_mult_M(size, output.View, mt.MemoryView, m.MemoryView);
            return new GPU_FloatData2D(output);
        }

        public IFloatData SumLine(IFloatData2D arr)
        {
            if (arr.H <= 1)
                return new GPU_FloatData(arr.AsArray());

            var s = arr.H / 2d;
            var r = arr.H % 2d;
            while (s > 1)
            {
                var _size = new Index2(arr.W, (int)s);

                _sumLines(_size, (int)Math.Ceiling(r), arr.MemoryView);
                r = s % 2d;
                s /= 2d;
            }
            return new GPU_FloatData(_joinLines(arr.W, arr.MemoryView));
        }

        public IFloatData SumColumn(IFloatData2D arr)
        {
            if (arr.W <= 1)
                return new GPU_FloatData(arr.AsArray());

            var s = arr.W / 2d;
            var r = arr.W % 2d;
            while (s > 1)
            {
                var _size = new Index2((int)s, arr.H);

                _sumColumns(_size, (int)Math.Ceiling(r), arr.MemoryView);
                r = s % 2;
                s /= 2;
            }
            return new GPU_FloatData(_joinColumns(arr.H, arr.MemoryView));
        }

        private void _sumLines(Index2 size, int r, ArrayView2D<float> m)
        {
            _M_SumLine(size, m, r, size.Y);
        }

        private void _sumColumns(Index2 size, int r, ArrayView2D<float> m)
        {
            _M_SumColumn(size, m, r, size.X);
        }

        private MemoryBuffer<float> _joinLines(Index size, ArrayView2D<float> m)
        {
            var output = ILGPUMethods.Allocate<float>(size);
            _M_2_lines_V(size, output.View, m);
            return output;
        }

        private MemoryBuffer<float> _joinColumns(Index size, ArrayView2D<float> m)
        {
            var output = ILGPUMethods.Allocate<float>(size);
            _M_2_columns_V(size, output.View, m);
            return output;
        }
    }
}


text:
package com.xinqihd.sns.gameserver.admin.gui;

import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.AbstractAction;

import com.mongodb.DBObject;
import com.xinqihd.sns.gameserver.admin.action.game.MyTableModelDeleteRowAction;
import com.xinqihd.sns.gameserver.admin.util.ImageUtil;
import com.xinqihd.sns.gameserver.admin.util.MongoUtil;
import com.xinqihd.sns.gameserver.config.ServerPojo;
import com.xinqihd.sns.gameserver.db.mongo.MapDBObject;
import com.xinqihd.sns.gameserver.service.RefreshMyTableService;

/**
 * It implements the GameDataPanel
 * @author wangqi
 *
 */
public class TaskServerListPanel extends AbstractTaskPanel {

	private static TaskServerListPanel instance = new TaskServerListPanel();

	public TaskServerListPanel() {
		init();
	}

	public static TaskServerListPanel getInstance() {
		return instance;
	}

	public void init() {
		//创建工作区域
		String collection = "servers";
		super.initModel(collection);

		hiddenFields.add("class");
		model.setHiddenFields(hiddenFields);
		RefreshMyTableService service = new RefreshMyTableService(model);
		service.execute();

		myTable.setTitle("游戏开服管理");
		myTable.setTableModel(model);
		myTable.setDelRowAction(new MyTableModelDeleteRowAction(myTable.getTable()));
		myTable.setBackupAction(backupAction);
		myTable.setAddRowAction(new AddServerAction());
		myTable.getTable().addMouseListener(new MouseAdapter() {

			/* (non-Javadoc)
			 * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
			 */
			@Override
			public void mouseClicked(MouseEvent e) {
				if ( e.getClickCount() == 2 ) {
					int rowIndex = myTable.getTable().getSelectedRow();
					if ( rowIndex >= 0 ) {
						int modelRowIndex = myTable.getTable().convertRowIndexToModel(rowIndex);
						ServerPojo selectedTask = null;
						DBObject dbObj = (DBObject)myTable.getTableModel().getRowObject(modelRowIndex);
						selectedTask = (ServerPojo)MongoUtil.constructObject(dbObj);

						AddOrEditServerDialog dialog = new AddOrEditServerDialog(selectedTask, false);
						dialog.setVisible(true);

						selectedTask = dialog.getServerPojo();
						if ( selectedTask != null ) {
							MapDBObject objToSave = new MapDBObject();
							objToSave.putAll(selectedTask);
							model.updateRow(objToSave, modelRowIndex);
						}
					}
				}
			}

		});
//		myTable.setColumnEditor(3, new GameDataEditor());
		this.add(myTable, "width 100%, height 100%");
	}

private class AddServerAction extends AbstractAction {

		public AddServerAction() {
			super("", ImageUtil.createImageSmallIcon("Button Add.png", "Add Row"));
		}

		/* (non-Javadoc)
		 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
		 */
		@Override
		public void actionPerformed(ActionEvent e) {
			int rowIndex = myTable.getTable().getSelectedRow();
			if ( rowIndex >= 0 ) {
				int modelRowIndex = myTable.getTable().convertRowIndexToModel(rowIndex);
				ServerPojo selectedTask = null;
				DBObject dbObj = (DBObject)myTable.getTableModel().getRowObject(modelRowIndex);
				selectedTask = (ServerPojo)MongoUtil.constructObject(dbObj);

				AddOrEditServerDialog dialog = new AddOrEditServerDialog(selectedTask, true);
				dialog.setVisible(true);

				selectedTask = dialog.getServerPojo();
				if ( selectedTask != null ) {
					MapDBObject objToSave = new MapDBObject();
					objToSave.putAll(selectedTask);
					model.insertRow(objToSave);
				}
			} else {
				AddOrEditServerDialog dialog = new AddOrEditServerDialog(null, false);
				dialog.setVisible(true);

				ServerPojo newTask = dialog.getServerPojo();
				if ( newTask != null ) {
					MapDBObject objToSave = new MapDBObject();
					objToSave.putAll(newTask);
					model.insertRow(objToSave);
				}
			}
		}
	}
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Optimizer
{
    public class Mortgage
    {
        public int startMonth { get; set; }
        public int repaymentLengthInMonths { get; set; }
        public decimal amountBorrowed { get; set; }
        public bool isRateFixed { get; set; }
        public decimal fixRate { get; set; }
    }
}


text:
layout: default
---

Posts

  {{ content }}

    {% for post in site.posts %}

          {{ post.categories }}

          {{ post.title | escape }}

            <svg class="icon icon-clock gray_mod">
              <use xlink:href="/assets/icons/sprite/sprite.svg#clock"></use>
            </svg>
            <time datetime="{{ post.date | date_to_xmlschema }}" itemprop="datePublished">
              {% assign date_format = site.minima.date_format | default: "%b %-d, %Y" %}
              {{ post.date | date: date_format }}
            </time>

            {% if post.author %}
            <svg class="icon icon-user gray_mod">
              <use xlink:href="/assets/icons/sprite/sprite.svg#user"></use>
            </svg>

          {{ post.author }}

            {% endif %}

          {{ post.excerpt }}

          Далее...

        {% include post_tags.html %}

    {% endfor %}

subscribe via RSS


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Text;

using Hydra.Framework.Helpers;

#pragma warning disable 419  // Ambigious cref in XML comment

namespace Hydra.Framework.Collections
{
    /// <summary>
    /// The class that is used to provide an untyped ICollection
    /// view onto a typed ICollection<T> interface.
    /// </summary>
    [Serializable]
    public class UntypedCollection<T>
        : ICollection
    {
        #region Member Variables
        /// <summary>
        /// Wrapped Collection
        /// </summary>
        private readonly ICollection<T> wrappedCollection;
        #endregion

        #region Constructors
        /// <summary>
        /// Create an untyped ICollection
        /// view onto a typed ICollection<T> interface.
        /// </summary>
        /// <param name="wrappedCollection">The ICollection<T> to wrap.</param>
        public UntypedCollection(ICollection<T> wrappedCollection)
        {
            this.wrappedCollection = wrappedCollection;
        }
        #endregion

        #region ICollection Implementation
        /// <summary>
        /// Copies the elements of the <see cref="T:System.Collections.ICollection"/> to an <see cref="T:System.Array"/>, starting at a particular <see cref="T:System.Array"/> index.
        /// </summary>
        /// <param name="array">The one-dimensional <see cref="T:System.Array"/> that is the destination of the elements copied from <see cref="T:System.Collections.ICollection"/>. The <see cref="T:System.Array"/> must have zero-based indexing.</param>
        /// <param name="index">The zero-based index in nodeCollection at which copying begins.</param>
        /// <exception cref="T:System.ArgumentNullException">
        /// nodeCollection is null. </exception>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// 	<paramref name="index"/> is less than zero. </exception>
        /// <exception cref="T:System.ArgumentException">
        /// nodeCollection is multidimensional.-or- The number of elements in the source <see cref="T:System.Collections.ICollection"/> is greater than the available space from <paramref name="index"/> to the end of the destination nodeCollection. </exception>
        /// <exception cref="T:System.ArgumentException">The type of the source <see cref="T:System.Collections.ICollection"/> cannot be cast automatically to the type of the destination nodeCollection. </exception>
        public void CopyTo(Array array, int index)
        {
            Check.That(array, Is.Not.Null);

            int i = 0;
            int count = wrappedCollection.Count;

            if (index < 0)
                throw new ArgumentOutOfRangeException("indexFunction", index, Hydra.Framework.Properties.Resources.ArgMustNotBeNegative);

            if (index >= array.Length ||
                count > array.Length - index)
                throw new ArgumentException("indexFunction", Hydra.Framework.Properties.Resources.ArrayTooSmall);

            foreach (T item in wrappedCollection)
            {
                if (i >= count)
                    break;

                array.SetValue(item, index);
                ++index;
                ++i;
            }
        }

        /// <summary>
        /// Gets the number of elements contained in the <see cref="T:System.Collections.ICollection"/>.
        /// </summary>
        /// <value></value>
        /// <returns>The number of elements contained in the <see cref="T:System.Collections.ICollection"/>.</returns>
        public int Count
        {
            get
            {
                return wrappedCollection.Count;
            }
        }

        /// <summary>
        /// Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection"/> is synchronized (thread safe).
        /// </summary>
        /// <value></value>
        /// <returns>true if access to the <see cref="T:System.Collections.ICollection"/> is synchronized (thread safe); otherwise, false.</returns>
        public bool IsSynchronized
        {
            get
            {
                return false;
            }
        }

        /// <summary>
        /// Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection"/>.
        /// </summary>
        /// <value></value>
        /// <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection"/>.</returns>
        public object SyncRoot
        {
            get
            {
                return this;
            }
        }

        /// <summary>
        /// Returns an enumerator that iterates through a collection.
        /// </summary>
        /// <returns>
        /// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
        /// </returns>
        public IEnumerator GetEnumerator()
        {
            return ((IEnumerable)wrappedCollection).GetEnumerator();
        }
        #endregion
    }
}


text:
import winston from 'winston';
import mongoose from 'mongoose';

// Overwrite mongoose promise module
mongoose.Promise = Promise;

/**
 * User Schema
 */
const UserSchema = new mongoose.Schema({
  username: {
    type: String,
    lowercase: false,
    uppercase: false,
    trim: null,
    match: null,
    enum: null,
    minlength: null,
    maxlength: null,
    required: false,
    default: false,
    select: false,
    validate: null,
    get: null,
    set: null,
    unique: false,
    sparse: false
},
  email: {
    type: String,
    lowercase: false,
    uppercase: false,
    trim: null,
    match: null,
    enum: null,
    minlength: null,
    maxlength: null,
    required: false,
    default: false,
    select: false,
    validate: null,
    get: null,
    set: null,
    unique: false,
    sparse: false
},
  password: {
    type: String,
    lowercase: false,
    uppercase: false,
    trim: null,
    match: null,
    enum: null,
    minlength: null,
    maxlength: null,
    required: false,
    default: false,
    select: false,
    validate: null,
    get: null,
    set: null,
    unique: false,
    sparse: false
},
  firstname: {
    type: String,
    lowercase: false,
    uppercase: false,
    trim: null,
    match: null,
    enum: null,
    minlength: null,
    maxlength: null,
    required: false,
    default: false,
    select: false,
    validate: null,
    get: null,
    set: null,
    unique: false,
    sparse: false
},
  lastname: {
    type: String,
    lowercase: false,
    uppercase: false,
    trim: null,
    match: null,
    enum: null,
    minlength: null,
    maxlength: null,
    required: false,
    default: false,
    select: false,
    validate: null,
    get: null,
    set: null,
    unique: false,
    sparse: false
},
  role: {
    type: String,
    lowercase: false,
    uppercase: false,
    trim: null,
    match: null,
    enum: [
        'member',
        'admin'
    ],
    minlength: null,
    maxlength: null,
    required: false,
    default: false,
    select: false,
    validate: null,
    get: null,
    set: null,
    unique: false,
    sparse: false
}
}, {
  collection: 'users',
  autoIndex: true,
  minimize: false,
  timestamps: true
});

/**
 * Methods
 */
/**
*Uncomment if needed

UserSchema.methods.findSimilarParam = () => new Promise((resolve, reject) => {
  this.model('User').find({ param: this.param }, (err, res) => {
    if (err) {
      reject(err);
    }
    resolve(res);
  });
});
*/

/**
 * Statics
 */
/**
*Uncomment if needed

UserSchema.statics.findByParam = param => new Promise((resolve, reject) => {
  this.find({ param: new RegExp(param, 'ig') }, (err, res) => {
    if (err) {
      reject(err);
    }
    resolve(res);
  });
});
*/

/**
 * Query Helpers
 */
/**
*Uncomment if needed

UserSchema.query.byParam = param => this.find({ param: new RegExp(param, 'ig') });
*/

/**
 * Indexes
 */
 /**
*Uncomment if needed

UserSchema.index({ param: 1, type: -1 });
*/

/**
 * Virtuals
 *//**
*Uncomment if needed

UserSchema.virtual('fullName')
  .get(() => `${this.name.first} ${this.name.last}`)
  .set((fullName) => {
    this.name.first = fullName.substr(0, fullName.indexOf(' '));
    this.name.last = fullName.substr(fullName.indexOf(' ') + 1);
  });
*/

/**
 * Pre Middleware
 *//**
*Uncomment if needed

UserSchema.pre('init', (next) => {
  // do something before a document is returned from mongodb
  next(); // if no errors, else call next(err)
});

UserSchema.pre('validate', (next) => {
  // do something before executing registered validation rules for this document
  next(); // if no errors, else call next(err)
});

UserSchema.pre('save', (next) => {
  // do something before saving this document
  next(); // if no errors, else call next(err)
});

UserSchema.pre('remove', (next) => {
  // do something before removing this document
  next(); // if no errors, else call next(err)
});
*/

/**
 * Post Middleware
 */
 /**
*Uncomment if needed

UserSchema.post('init', (doc) => {
  // do something after
  winston.log('info', 'Document with _id %s initiated', doc._id);
});

UserSchema.post('validate', (doc) => {
  // do something after
  winston.log('info', 'Document with _id %s validated', doc._id);
});

UserSchema.post('save', (doc) => {
  // do something after
  winston.log('info', 'Document with _id %s saved', doc._id);
});

UserSchema.post('remove', (doc) => {
  // do something after
  winston.log('info', 'Document with _id %s removed', doc._id);
});
*/

/**
 * @typedef User
 */
export default mongoose.model('User', UserSchema);


text:
package ariba.util.core;

import java.util.Comparator;
import java.util.PriorityQueue;

/**
 * An implementation of a TimerQueue that stores the Timers in a PriorityQueue. If you
 * are creating a TimerQueue that needs to store many timers, this is probably a good
 * choice.
 */
public class HeapTimerQueue extends TimerQueue
{
    /** The PriorityQueue that stores the Timers */
    private PriorityQueue<Timer> heap;

    /**
     * Create and start a new HeapTimerQueue
     */
    public HeapTimerQueue ()
    {
        heap = new PriorityQueue<Timer>(100,
                new TimerComparator());
        start();
    }

    /**
     * Add a new Timer to the queue that will fire after the specified time
     *
     * @param timer The Timer to add
     * @param expirationTime The time at which the timer should fire.
     */
    @Override
    synchronized void addTimer (Timer timer, long expirationTime)
    {
        timer.expirationTime = expirationTime;
        heap.add(timer);
        notify();
    }

    /**
     * Remove a Timer from the queue. This does a linear search through the elements in
     * the queue, so it should probably be avoided if possible.
     * @param timer
     */
    @Override
    synchronized void removeTimer (Timer timer)
    {
        heap.remove(timer);
    }

    /**
     * Get the number of Timers that are in this queue. (Repeating timers are counted
     * once).
     * @return the current number of pending timers.
     */
    @Override
    public int size ()
    {
        return heap.size();
    }

    /**
     * Remove the first timer in the queue.
     */
    void removeFirstTimer ()
    {
        heap.remove();
    }

    /**
     * Get the first timer in the queue
     * @return The first (soonest to fire) Timer.
     */
    Timer getFirstTimer ()
    {
        return heap.peek();
    }

    public String toString ()
    {
        return Fmt.S("HeapTimerQueue (%s)", heap);
    }

    /**
     * Comparator used for ordering the timers in the queue.
     */
    static class TimerComparator implements Comparator<Timer>
    {
        public int compare (Timer t1, Timer t2)
        {
            if (t1 == t2) {
                return 0;
            }
            if (t1 == null) {
                return 1;
            }
            if (t2 == null) {
                return -1;
            }
            // most important is comparing the expirationTime
            if (t1.expirationTime != t2.expirationTime) {
                return t1.expirationTime < t2.expirationTime ? -1 : 1;
            }
            // add in some other comparisons to make the result more stable
            else if (t1.repeats != t2.repeats) {
                return t1.repeats ? -1 : 1;
            }
            else if (t1.delay != t2.delay) {
                return t1.delay < t2.delay ? -1 : 1;
            }
            return t1.getCommand().compareTo(t2.getCommand());
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
    <EditTextPreference
        android:key="pref_apikey"
        android:title="@string/pref_apikey"
        android:summary="@string/pref_apikey_summ"
        android:defaultValue="" />
</PreferenceScreen>


text:
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {I18NService} from './services/i18n.service';
import {I18nPipe} from './pipes/i18n.pipe';
import {I18NComponent} from './components/i18n.component';

@NgModule({
	imports: [
		CommonModule
	],
	declarations: [
		I18nPipe,
		I18NComponent
	],
	exports: [
		I18nPipe,
		I18NComponent
	],
	providers: [
		I18NService
	]
})
export class I18nModule {
}


text:
module.exports = require('machine').build({

  friendlyName: 'Teardown',

  description: 'Destroys a connection manager so that a server can be shut down cleanly.',

  inputs: {

    identity: {
      description: 'The datastore identity to teardown.',
      required: true,
      type: 'ref'
    },

    datastores: {
      description: 'An object containing all of the data stores that have been registered.',
      required: true,
      type: 'ref'
    },

    modelDefinitions: {
      description: 'An object containing all of the model definitions that have been registered.',
      required: true,
      type: 'ref'
    }

  },

  exits: {

    success: {
      description: 'The data store was initialized successfully.'
    },

    badConfiguration: {
      description: 'The configuration was invalid.'
    }

  },

  fn: function teardown(inputs, exits) {
    // Dependencies
    var Helpers = require('./private');

    var datastore = inputs.datastores[inputs.identity];
    if (!datastore) {
      return exits.error(new Error('Invalid data store identity. No data store exist with that identity.'));
    }

    //  ╔╦╗╔═╗╔═╗╔╦╗╦═╗╔═╗╦ ╦  ┌┬┐┌─┐┌┐┌┌─┐┌─┐┌─┐┬─┐
    //   ║║║╣ ╚═╗ ║ ╠╦╝║ ║╚╦╝  │││├─┤│││├─┤│ ┬├┤ ├┬┘
    //  ═╩╝╚═╝╚═╝ ╩ ╩╚═╚═╝ ╩   ┴ ┴┴ ┴┘└┘┴ ┴└─┘└─┘┴└─
    var manager = datastore.manager;
    if (!manager) {
      return exits.error(new Error('Missing manager for this data store. The data store may be in the process of being destroyed.'));
    }

    Helpers.connection.destroyManager(manager, function destroyManagerCb(err) {
      if (err) {
        return exits.error(err);
      }

      // Delete the rest of the data from the data store
      delete inputs.datastores[inputs.identity];

      // Delete the model definitions
      delete inputs.modelDefinitions[inputs.identity];

      return exits.success();
    });
  }
});


text:
<link rel="stylesheet" href="/eSDK_OpenAPI_Demo_BS_JAVA/css/tree.css"
	type="text/css">
<link rel="stylesheet"
	href="/eSDK_OpenAPI_Demo_BS_JAVA/css/zTreeStyle.css" type="text/css">
<link rel="stylesheet" href="/eSDK_OpenAPI_Demo_BS_JAVA/css/demo.css"
	type="text/css" />
<link href="/eSDK_OpenAPI_Demo_BS_JAVA/css/thickbox.css" media="screen"
	rel="stylesheet" type="text/css" />

				*
				<input type="text" id="portGroupname"
					name="portGroupname">

				*
				<input type="text" id="portGroupDescription"
					name="portGroupDescription">

				*
				<select id="portType" name="portType"
					style="width: 60px;" onchange="updatePort()">
						<option value="iscsi">ISCSI</option>
						<option value="fc">FC</option>
				</select> <select id="associateId_port" name="associateId_port"
					onmouseover="FixWidth(this)"><option></option></select>

				<input class="btn"
					onmouseover="this.className='btn_mouseover'"
					onmouseout="this.className='btn'" type="button"
					id="createPortGroupBtn" onclick="createPortGroup();">


text:
package com.stratio.explorer.cassandra.dto;

import com.stratio.explorer.cassandra.constants.StringConstants;
import com.stratio.explorer.cassandra.models.CellData;
import com.stratio.explorer.cassandra.models.RowData;
import com.stratio.explorer.cassandra.models.Table;
import com.stratio.explorer.cassandra.utils.ListUtils;
import org.junit.Test;

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

import static org.junit.Assert.assertThat;

import static org.junit.Assert.assertEquals;
import static org.hamcrest.Matchers.is;

public class CellTableDTOTest {

    @Test
    public void whenCellContainsTable(){
       String keySpace ="keySpace";
       String cellValueOne ="cellValueOne";
       String cellValueTwo ="cellValueTwo";
       CellData<Table> cellWithTable = new CellData<Table>(buildTable(keySpace,cellValueOne,cellValueTwo));
       CellTableDTO cellDTO = new CellTableDTO();
       String dto =cellDTO.toDTO(cellWithTable);
       assertThat("Result should be table formatted to TO",dto,is( "keySpace" + System.getProperty("line.separator") + cellValueOne + StringConstants.TABULATOR + cellValueTwo));

    }

    private Table buildTable(String headerValue,String... cellValues){
        List<String> header =new ListUtils<String>().buildList(headerValue);
        List<CellData> cells = new ListUtils<CellData>().buildList(new CellData(cellValues[0]),new CellData(cellValues[1]));
        List<RowData> rows = new ListUtils<RowData>().buildList(new RowData(cells));
        return new Table(header,rows);
    }
}