text:
BSLS_IDENT("$Id: $")

//@PURPOSE: Provide a cache for IP addresses resolved from given hostnames.
//
//@CLASSES:
//  btlso::IpResolutionCache: cache for IP addresses resolved from hostnames.
//
//@SEE_ALSO: btlso_resolveutil, btlso_ipv4address
//
//@DESCRIPTION: This component defines a mechanism, 'btlso::IpResolutionCache',
// that serves as a cache of 'btlso::IPv4Address' objects that are associated
// with a hostname.  A 'btlso::IpResolutionCache' object is supplied the
// address of a 'btlso::ResolveUtil::ResolveByNameCallback' function at
// construction, which it subsequently uses to obtain the set of IP addresses
// for a given hostname.  The 'resolveAddress' method returns a set of IP
// addresses for a supplied hostname.  'resolveAddress' either returns values
// already residing in the cache (if they haven't expired), or invokes the
// supplied 'ResolveByNameCallback' to obtain the set of IP addresses, which
// are then cached for subsequent use.  IP addresses stored in the cache are
// considered valid for a user-defined time interval, set by the
// 'setTimeToLive' method.  Stored IP addresses older than the configured
// interval are considered stale, and a subsequent request for the associated
// hostname will refresh that set of IP addresses by again invoking the
// 'ResolveByNameCallback' object supplied at construction.
//
///Thread Safety
///-------------
// 'btlso::IpResolutionCache' is fully *thread-safe*, meaning that all
// non-creator operations on an object can be safely invoked simultaneously
// from multiple threads.
//
///Usage
///-----
// This section illustrates intended use of this component.
//
///Example 1: Retrieving the IPv4 Addresses of a Given Host
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// In this example, we create a 'btlso::IpResolutionCache', and use it to
// retrieve the IPv4 addresses of several host machines.
//
// First, we create a 'btlso::IpResolutionCache' object, which by default, will
// use 'btlso::ResolveUtil::defaultResolveByNameCallback' to retrieve addresses
// that are not in the cache:
//..
//  btlso::IpResolutionCache cache;
//..
// Then, we verify the newly constructed cache does not contain the addresses
// of either "www.bloomberg.com" and "www.businessweek.com":
//..
//  bsl::vector<btlso::IPv4Address> ipAddresses;
//  assert(0 != cache.lookupAddressRaw(&ipAddresses, "www.bloomberg.com", 1));
//  assert(0 != cache.lookupAddressRaw(&ipAddresses,
//                                     "www.businessweek.com",
//                                     1));
//..
// Next, we call the 'resolveAddress' method to retrieve one of the IP address
// for "www.bloomberg.com", and then print out the returned address.  Note that
// since this is the first call to 'resolveAddress' for "www.bloomberg.com",
// 'resolverCallback' will be invoked to retrieve the addresses:
//..
//  int rc = cache.resolveAddress(&ipAddresses, "www.bloomberg.com", 1);
//  assert(0 == rc);
//  assert(1 == ipAddresses.size());
//..
// Now, we write the address to stdout:
//..
//  bsl::cout << "IP Address: " << ipAddresses[0] << bsl::endl;
//..
// The output of the preceding operation will look like:
//..
//  IP Address: 63.85.36.34:0
//..
// Note that the IP address may differ depending on the configurations of the
// machine on which the code is executed.
//
// Finally, we verify that a subsequent call to 'lookupAddressRaw' returns 0
// for "www.bloomberg.com" (indicating that its addresses are stored in the
// cache), but returns non-zero for "www.businessweek.com" (indicating its
// addresses are not):
//..
//  assert(0 == cache.lookupAddressRaw(&ipAddresses, "www.bloomberg.com", 1));
//  assert(0 != cache.lookupAddressRaw(&ipAddresses,
//                                     "www.businessweek.com",
//                                     1));
//..
//
///Example 2: Using Address Cache with 'btlso::ResolveUtil'
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// In this example, we demonstrate how to configure the 'bteso::ResolverUtil'
// component to use a 'btlso::IpResolutionCache' object for resolving IP
// addresses.
//
// In order to use a 'btlso::IpResolutionCache' as the resolution callback in
// 'btlso::ResolveUtil', we must wrap the call to
// 'btlso::IpResolutionCache::resolveAddress' in a free function.
//
// When configuring 'btlso::ResolveUtil', a singleton cache should be created
// to ensure the cache exist for all calls to 'btlso::ResolveUtil::getAddress'.
// First, we create a function that initializes the singleton cache on the
// first execution and returns the address of the cache:
//..
//  static
//  btlso::IpResolutionCache *ipCacheInstance()
//  {
//      static btlso::IpResolutionCache *singletonCachePtr = 0;
//      BSLMT_ONCE_DO {
//          if (0 == singletonCachePtr) {
//              bslma::Allocator *allocator =
//                                           bslma::Default::globalAllocator();
//              static btlso::IpResolutionCache cache(allocator);
//              singletonCachePtr = &cache;
//          }
//      }
//      return singletonCachePtr;
//  }
//..
// Then, we create a free function to wrap the
// 'btlso::IpResolutionCache::resolveAddress' method:
//..
//  static
//  int resolverCallback(bsl::vector<btlso::IPv4Address> *hostAddresses,
//                       const char                      *hostName,
//                       int                              numAddresses,
//                       int                             *errorCode)
//  {
//      return ipCacheInstance()->resolveAddress(hostAddresses,
//                                               hostName,
//                                               numAddresses,
//                                               errorCode);
//  }
//..
// Now, we set the callback for 'btlso::ResolveUtil' to the free function we
// just created:
//..
//  btlso::ResolveUtil::setResolveByNameCallback(&resolverCallback);
//..
// Finally, we call the 'btlso::ResolveUtil::getAddress' method to retrieve the
// IPv4 address of 'www.bloomberg.com':
//..
//  btlso::IPv4Address ipAddress;
//  btlso::ResolveUtil::getAddress(&ipAddress, "www.bloomberg.com");
//..
// Now, we write the address to stdout:
//..
//  bsl::cout << "IP Address: " << ipAddress << bsl::endl;
//..
// Finally, we observe the output to be in the form:
//..
//  IP Address: 63.85.36.34:0
//..

#ifndef INCLUDED_BTLSCM_VERSION
#include <btlscm_version.h>
#endif

#ifndef INCLUDED_BTLSO_IPV4ADDRESS
#include <btlso_ipv4address.h>
#endif

#ifndef INCLUDED_BTLSO_RESOLVEUTIL
#include <btlso_resolveutil.h>
#endif

#ifndef INCLUDED_BSLMT_MUTEX
#include <bslmt_mutex.h>
#endif

#ifndef INCLUDED_BSLMT_READLOCKGUARD
#include <bslmt_readlockguard.h>
#endif

#ifndef INCLUDED_BSLMT_RWMUTEX
#include <bslmt_rwmutex.h>
#endif

#ifndef INCLUDED_BSLMT_WRITELOCKGUARD
#include <bslmt_writelockguard.h>
#endif

#ifndef INCLUDED_BDLT_DATETIMEINTERVAL
#include <bdlt_datetimeinterval.h>
#endif

#ifndef INCLUDED_BSLMA_ALLOCATOR
#include <bslma_allocator.h>
#endif

#ifndef INCLUDED_BSLMA_USESBSLMAALLOCATOR
#include <bslma_usesbslmaallocator.h>
#endif

#ifndef INCLUDED_BSLMF_NESTEDTRAITDECLARATION
#include <bslmf_nestedtraitdeclaration.h>
#endif

#ifndef INCLUDED_BSL_MAP
#include <bsl_map.h>
#endif

#ifndef INCLUDED_BSL_MEMORY
#include <bsl_memory.h>
#endif

#ifndef INCLUDED_BSL_VECTOR
#include <bsl_vector.h>
#endif

namespace BloombergLP {

namespace btlso {

class IpResolutionCache;
class IpResolutionCache_Data;

                        // =============================
                        // class IpResolutionCache_Entry
                        // =============================

class IpResolutionCache_Entry {
    // This class implements an entry type that is used in the 'bsl::map'
    // contained in a 'IpResolutionCache' object.  This is an implementation
    // centric class, with each object of this class containing a shared
    // pointer to a 'IpResolutionCache_Data' object (which stores a set of IP
    // addresses and its creation time) and a mutex variable to indicate
    // whether there is a thread updating the data.  This class allows a thread
    // to continue accessing existing data while another thread lock the mutex
    // variable and update the data.  Note that synchronization of the data of
    // an entry is managed by the cache containing the entry.

  public:
    typedef bsl::shared_ptr<const IpResolutionCache_Data> DataPtr;
        // 'DataPtr' is an alias for a shared pointer to a
        // 'IpResolutionCache_Data' object (defined in the '.cpp' file) that is
        // used to contain the set of IP addresses for a hostname

  private:
    // DATA
    DataPtr      d_data;          // pointer to a 'IpResolutionCache_Data'
                                  // object

    bslmt::Mutex d_updatingLock;  // mutex used to signal that a thread is
                                  // retrieving new data (but does *not*
                                  // synchronize access to 'd_data')

  private:
    // NOT IMPLEMENTED
    IpResolutionCache_Entry& operator=(const IpResolutionCache_Entry&);

  public:
    // CREATORS
    IpResolutionCache_Entry();
        // Create a 'IpResolutionCache_Entry' object.  By default, this object
        // holds a null reference to a 'IpResolutionCache_Data' object.

    IpResolutionCache_Entry(const IpResolutionCache_Entry& original);
        // Create a 'IpResolutionCache_Entry' object that refers to the same
        // 'IpResolutionCache_Data' object as the specified 'original'.  The
        // newly created entry does not share an 'updatingLock' with
        // 'original'.  Note that this copy constructor is provided to allow an
        // entry to be stored in a 'bsl::map'.

    // MANIPULATORS
    void setData(DataPtr value);
        // Make this object refer to the same 'IpResolutionCache_Data' object
        // as the specified 'value'.  The behavior is undefined unless the
        // calling thread has a write lock on the cache containing this entry.

    void reset();
        // Reset this object to hold a null reference to a
        // 'IpResolutionCache_Data' object.  The behavior is undefined unless
        // the calling thread has a write lock on the cache containing this
        // entry.

    bslmt::Mutex& updatingLock();
        // Return a reference providing modifiable access to a mutex used to
        // signal a thread is retrieving new 'data'.  Note that 'updatingLock'
        // does *not* synchronize access to 'data'; access to 'data' is
        // synchronized by a read-write mutex in the cache containing this
        // entry.

    // ACCESSORS
    DataPtr data() const;
        // Return a shared pointer to the non-modifiable
        // 'IpResolutionCache_Data' object referred to by this object.  The
        // behavior is undefined unless the calling thread has a read lock on
        // the cache containing this entry.
};

                        // =======================
                        // class IpResolutionCache
                        // =======================

class IpResolutionCache {
    // This class provides an efficient mechanism for retrieving the IPv4
    // addresses of a host machine given its hostname.  The first time a client
    // requests the addresses for a hostname, those addresses are retrieved
    // (using the 'resolverCallback' supplied at construction), and cached for
    // future use.  Subsequent requests for the same hostname return the cached
    // information (unless the information is stale).  The cached addresses
    // remains in the cache for a user-defined time, which defaults to one
    // hour.  Stored IP addresses older than the configured interval are
    // considered stale, and a subsequent request for the associated hostname
    // will refresh that set of IP addresses by calling the 'resolverCallback',
    // supplied at construction.
    //
    // This class:
    //: o is *exception-neutral*
    //: o is *fully* *thread-safe*
    // For terminology see 'bsldoc_glossary'.

  public:
    typedef ResolveUtil::ResolveByNameCallback ResolveByNameCallback;
        // Alias to the function type of the resolver of 'ResolveUtil'.

  private:
    // DATA
    typedef bsl::map<bsl::string, IpResolutionCache_Entry> AddressMap;

    AddressMap              d_cache;            // map to store the data

    bdlt::DatetimeInterval  d_timeToLive;       // configured interval for old
                                                // to become stale

    mutable bslmt::RWMutex  d_rwLock;           // access synchronization for
                                                // reading/writing to 'd_cache'
                                                // *and* the shared 'data' in
                                                // the entries of 'd_cache'

    ResolveByNameCallback   d_resolverCallback; // callback to get data

    bslma::Allocator       *d_allocator_p;      // allocator (held, not owned)

  private:
    int getCacheData(IpResolutionCache_Entry::DataPtr *result,
                     const char                       *hostname,
                     int                              *errorCode);
        // Load, into the specified 'result', a 'bsl::shared_ptr' referring to
        // a vector of addresses for the specified 'hostname', and, if an error
        // occurs, load into the specified 'errorCode', the error code returned
        // by the callback function.  If the cache already contains an entry
        // for 'hostname' younger than the configured time-to-live, that entry
        // is loaded into 'result', otherwise the callback supplied at
        // construction is invoked to populate a new entry in the cache, and
        // that entry is then loaded into 'result'.  Return 0 on success, and a
        // non-zero value otherwise.

  private:
    // NOT IMPLEMENTED
    IpResolutionCache(const IpResolutionCache&);
    IpResolutionCache& operator=(const IpResolutionCache&);

  public:
    // TRAITS
    BSLMF_NESTED_TRAIT_DECLARATION(IpResolutionCache,
                                   bslma::UsesBslmaAllocator);

    // CREATORS
    explicit IpResolutionCache(bslma::Allocator      *basicAllocator = 0);
    explicit IpResolutionCache(ResolveByNameCallback  resolverCallback,
                               bslma::Allocator      *basicAllocator = 0);
        // Create a 'IpResolutionCache' object.  Optionally specify
        // 'resolverCallback' used to resolve the IP addresses from a hostname.
        // If 'resolverCallback' is not specified,
        // 'AddressUtil::getAddressDefault' will be used.  Optionally specify a
        // 'basicAllocator' used to supply memory.  If 'basicAllocator' is 0,
        // the currently installed default allocator is used.

    // MANIPULATORS
    void removeAll();
        // Remove all cached data.

    int resolveAddress(bsl::vector<IPv4Address> *result,
                       const char               *hostname,
                       int                       maxNumAddresses,
                       int                      *errorCode = 0);
        // Load, into the specified 'result', the resolved IPv4 addresses of
        // the host with the specified 'hostname', up to the specified
        // 'maxNumAddresses' on success.  Optionally specify 'errorCode' to
        // store the error code returned by the resolver callback if the data
        // is not cached.  If 'errorCode' is 0, the error code of the callback
        // is ignored.  If the cache already contains an entry for 'hostname'
        // younger than the configured time-to-live, that entry is loaded into
        // 'result', otherwise, the callback supplied at construction is
        // invoked to populate a new entry in the cache, and that entry is then
        // loaded into 'result'.  Return 0 on success with no effect on the
        // 'errorCode', and a non-zero value with no effect on 'result'
        // otherwise.  The behavior is undefined unless '1 <= maxNumAddresses'.

    void setTimeToLive(const bdlt::DatetimeInterval& value);
        // Set the time the cached IP addresses for a particular hostname may
        // exist before they are considered stale.  A 'value' of 0 seconds
        // indicates the addresses will never expire.  The behavior is
        // undefined unless '0 <= value.totalSeconds()'.  Note that this
        // function will affect data that is already cached.

    // ACCESSORS
    bslma::Allocator *allocator() const;
        // Return the allocator used by this object to supply memory.

    int lookupAddressRaw(bsl::vector<IPv4Address> *result,
                         const char               *hostname,
                         int                       maxNumAddresses) const;
        // Load, into the specified 'result', the IPv4 addresses of the host
        // with the specified 'hostname' up to the specified 'maxNumAddresses'
        // if the data already exist in the cache (regardless of whether the
        // addresses are stale).  Return 0 if the data has been previously
        // cached (by a call to 'resolveAddress'), and a non-zero value with no
        // effect on 'result' otherwise.  The behavior is undefined unless
        // '1 <= maxNumAddresses'.  Note that this method will not refresh the
        // addresses even if they become stale.

    ResolveByNameCallback resolverCallback() const;
        // Return the address of the callback function that is used for
        // resolving the IP addresses from a hostname when the hostname is not
        // already in the cache or the IP addresses are stale.

    const bdlt::DatetimeInterval& timeToLive() const;
        // Return a reference providing non-modifiable access to the time a set
        // of IP addresses for a particular hostname may exist in the cache
        // before they become stale.  Note that '0 <= timeToLive().seconds()'.
};

// ============================================================================
//                        INLINE FUNCTION DEFINITIONS
// ============================================================================

                        // -----------------------------
                        // class IpResolutionCache_Entry
                        // -----------------------------

// CREATORS
inline
IpResolutionCache_Entry::IpResolutionCache_Entry()
: d_data()
, d_updatingLock()
{
}

inline
IpResolutionCache_Entry::IpResolutionCache_Entry(
                                          const IpResolutionCache_Entry& other)
: d_data(other.d_data)
, d_updatingLock()
{
}

// MANIPULATORS
inline
void IpResolutionCache_Entry::setData(DataPtr value)
{
    d_data = value;
}

inline
void IpResolutionCache_Entry::reset()
{
    d_data.reset();
}

inline
bslmt::Mutex& IpResolutionCache_Entry::updatingLock()
{
    return d_updatingLock;
}

// ACCESSORS
inline
IpResolutionCache_Entry::DataPtr IpResolutionCache_Entry::data() const
{
    return d_data;
}

                        // -----------------------
                        // class IpResolutionCache
                        // -----------------------

// MANIPULATORS

inline
void IpResolutionCache::setTimeToLive(const bdlt::DatetimeInterval& value)
{
    BSLS_ASSERT_SAFE(0 <= value.totalSeconds());

    bslmt::WriteLockGuard<bslmt::RWMutex> writeLockGuard(&d_rwLock);
    d_timeToLive = value;
}

// ACCESSORS
inline
bslma::Allocator *IpResolutionCache::allocator() const
{
    return d_allocator_p;
}

inline
IpResolutionCache::ResolveByNameCallback
IpResolutionCache::resolverCallback() const
{
    return d_resolverCallback;
}

inline
const bdlt::DatetimeInterval& IpResolutionCache::timeToLive() const
{
    bslmt::ReadLockGuard<bslmt::RWMutex> readLockGuard(&d_rwLock);
    return d_timeToLive;
}

}  // close package namespace

}  // close enterprise namespace

#endif

// ----------------------------------------------------------------------------
// Copyright 2015 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:
import { Value } from 'slate';
import Plain from 'slate-plain-serializer';

export default function contentToText(content) {
  const value = Value.fromJSON(content);
  const text = Plain.serialize(value);
  return text;
}

redpajama_set_name: RedPajamaGithub


text:
from swgpy.object import *

def create(kernel):
	result = Tangible()

	result.template = "object/tangible/loot/bestine/shared_bestine_painting_schematic_house.iff"
	result.attribute_template_id = -1
	result.stfName("craft_furniture_ingredients_n","painting_schematic_house")

	#### BEGIN MODIFICATIONS ####
	####  END MODIFICATIONS  ####

	return result


text:
package pss.rookscore;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.EditText;

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

import pss.rookscore.core.model.Player;
import pss.rookscore.core.events.PlayerAddedEvent;
import pss.rookscore.core.events.PlayerLoadRequestEvent;
import pss.rookscore.core.events.PlayersRemovedEvent;
import pss.rookscore.fragments.PlayerListFragment;
import pss.rookscore.fragments.PlayerListFragment.PlayerSelectionListener;

public class AddPlayerActivity extends Activity implements PlayerSelectionListener {

    /* package */static final String ADD_PLAYER_RESULT_KEY =  AddPlayerActivity.class.getName() + ".AddPlayerResult";
    public static final String PLAYER_NAMES_KEY = AddPlayerActivity.class.getName() + ".PlayerNames";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.add_player_activity);

        ((PlayerListFragment)getFragmentManager().findFragmentById(R.id.playerListFragment)).setPlayerListSelectionListener(this);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.add_player, menu);
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == R.id.addNewPlayer) {
            final AlertDialog.Builder alert = new AlertDialog.Builder(this);

            alert.setTitle(R.string.add_player_new_player_dialog_title);

            alert.setMessage(R.string.add_player_new_player_dialog_message);

            alert.setView(getLayoutInflater().inflate(R.layout.add_player_dialog, null));

            // Set an EditText view to get user input
            alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {

                    EditText firstName = (EditText)((AlertDialog)dialog).findViewById(R.id.firstNameText);
                    EditText lastName = (EditText)((AlertDialog)dialog).findViewById(R.id.lastNameText);

                    Player player = new Player(firstName.getText().toString(), lastName.getText().toString());
                    addPlayer(player);
                    playerSelected(Collections.singletonList(player));
                }
            });

            alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    // Canceled.
                }
            });

            AlertDialog alertDialog = alert.show();
            alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);

            return true;
        } else {
            return super.onOptionsItemSelected(item);
        }

    }

    protected void addPlayer(Player player) {
        ((RookScoreApplication)getApplication()).getEventBus().post(new PlayerAddedEvent(player));
        loadPlayerList();
    }

    @Override
    protected void onResume() {
        super.onResume();
        loadPlayerList();
    }

    private void loadPlayerList() {
        final PlayerListFragment plf = (PlayerListFragment) getFragmentManager().findFragmentById(R.id.playerListFragment);
        plf.setPlayerList(new ArrayList<Player>());
        ((RookScoreApplication)getApplication()).getEventBus().post(new PlayerLoadRequestEvent(new PlayerLoadRequestEvent.PlayerSink() {
            @Override
            public void addPlayer(final Player localStorePlayer) {
                runOnUiThread(new Runnable() {
                    public void run() {
                        plf.addToPlayerList(localStorePlayer);
                    }
                });

            }
        }));

    }

    @Override
    public void playerSelected(List<Player> playerNames) {
        Intent i = new Intent();
        Player players[] = playerNames.toArray(new Player[playerNames.size()]);
        i.putExtra(ADD_PLAYER_RESULT_KEY, players);
        setResult(RESULT_OK, i);
        finish();
    }

    @Override
    public void playerRemoved(final List<Player> players) {

        Object args[] = new Object[players.size() + 1];
        args[0] = players.size();
        for(int i = 0; i < players.size(); i++){
            args[i + 1] = players.get(i);
        }

        // prompt to delete
        new AlertDialog.Builder(this)
                .setIcon(android.R.drawable.ic_dialog_alert)
                .setTitle(getResources().getQuantityString(R.plurals.add_player_remove_multi_player_dialog_title, players.size(), args))
                .setMessage(getResources().getQuantityString(R.plurals.add_player_remove_multi_player_dialog_message, players.size(), args))
                .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        ((RookScoreApplication)getApplication()).getEventBus().post(new PlayersRemovedEvent(players));
                        loadPlayerList();
                    }
                })
                .setNegativeButton(R.string.no, null)
                .show();

    }
}


text:
package com.microsoft.bingads.campaignmanagement;

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

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

 * <complexType name="ArrayOfStateTargetBid">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="StateTargetBid" type="{https://bingads.microsoft.com/CampaignManagement/v9}StateTargetBid" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfStateTargetBid", propOrder = {
    "stateTargetBids"
})
public class ArrayOfStateTargetBid {

    @XmlElement(name = "StateTargetBid", nillable = true)
    protected List<StateTargetBid> stateTargetBids;

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

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

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

     *    getStateTargetBids().add(newItem);
     *

     *
     *
     *

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

}


text:
// T4 code generation is enabled for model 'C:\Users\kiss4eto\Documents\SQL Server Management Studio\DB Homework\9. Entity Framework Performance\TelerikAcademy.Model\TelerikAcademyModel.edmx'.
// To enable legacy code generation, change the value of the 'Code Generation Strategy' designer
// property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model
// is open in the designer.

// If no context and entity classes have been generated, it may be because you created an empty model but
// have not yet chosen which version of Entity Framework to use. To generate a context class and entity
// classes for your model, open the model in the designer, right-click on the designer surface, and
// select 'Update Model from Database...', 'Generate Database from Model...', or 'Add Code Generation
// Item...'.


text:
namespace ash {
const char kChromeUIFilesInternalsHost[] = "files-internals";
const char kChromeUIFilesInternalsURL[] = "chrome://files-internals";
}  // namespace ash


text:
<?php

namespace Perry\Representation\Eve\v3;

use Perry\Representation\Reference as Reference;
use Perry\Representation\Base as Base;

class Api extends Base
{
    public $motd;

    public $crestEndpoint;

    public $corporationRoles;

    public $itemGroups;

    public $channels;

    public $corporations;

    public $alliances;

    public $itemTypes;

    public $decode;

    public $battleTheatres;

    public $marketPrices;

    public $itemCategories;

    public $regions;

    public $bloodlines;

    public $marketGroups;

    public $sovereignty;

    public $tournaments;

    public $map;

    public $virtualGoodStore;

    public $serverVersion;

    public $wars;

    public $incursions;

    public $races;

    public $authEndpoint;

    public $serviceStatus;

    public $userCounts;

    public $industry;

    public $clients;

    public $time;

    public $marketTypes;

    public $serverName;

    // by Warringer\Types\Dict
    public function setMotd($motd)
    {
        // by Warringer\Types\Dict
        $converters = [];
        $converters['dust'] = function ($value) { return new Reference($value); };
        $converters['eve'] = function ($value) { return new Reference($value); };
        $converters['server'] = function ($value) { return new Reference($value); };

        $func = function ($value) use ($converters) {
            $return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS);
            $return['dust'] = isset($value->{'dust'}) ? $converters['dust']($value->{'dust'}) : null;
            $return['eve'] = isset($value->{'eve'}) ? $converters['eve']($value->{'eve'}) : null;
            $return['server'] = isset($value->{'server'}) ? $converters['server']($value->{'server'}) : null;

            return $return;
        };
        $this->motd = $func($motd);
    }

    // by Warringer\Types\Reference
    public function setCrestEndpoint($crestEndpoint)
    {
        $this->crestEndpoint = new Reference($crestEndpoint);
    }

    // by Warringer\Types\Reference
    public function setCorporationRoles($corporationRoles)
    {
        $this->corporationRoles = new Reference($corporationRoles);
    }

    // by Warringer\Types\Reference
    public function setItemGroups($itemGroups)
    {
        $this->itemGroups = new Reference($itemGroups);
    }

    // by Warringer\Types\Reference
    public function setChannels($channels)
    {
        $this->channels = new Reference($channels);
    }

    // by Warringer\Types\Reference
    public function setCorporations($corporations)
    {
        $this->corporations = new Reference($corporations);
    }

    // by Warringer\Types\Reference
    public function setAlliances($alliances)
    {
        $this->alliances = new Reference($alliances);
    }

    // by Warringer\Types\Reference
    public function setItemTypes($itemTypes)
    {
        $this->itemTypes = new Reference($itemTypes);
    }

    // by Warringer\Types\Reference
    public function setDecode($decode)
    {
        $this->decode = new Reference($decode);
    }

    // by Warringer\Types\Reference
    public function setBattleTheatres($battleTheatres)
    {
        $this->battleTheatres = new Reference($battleTheatres);
    }

    // by Warringer\Types\Reference
    public function setMarketPrices($marketPrices)
    {
        $this->marketPrices = new Reference($marketPrices);
    }

    // by Warringer\Types\Reference
    public function setItemCategories($itemCategories)
    {
        $this->itemCategories = new Reference($itemCategories);
    }

    // by Warringer\Types\Reference
    public function setRegions($regions)
    {
        $this->regions = new Reference($regions);
    }

    // by Warringer\Types\Reference
    public function setBloodlines($bloodlines)
    {
        $this->bloodlines = new Reference($bloodlines);
    }

    // by Warringer\Types\Reference
    public function setMarketGroups($marketGroups)
    {
        $this->marketGroups = new Reference($marketGroups);
    }

    // by Warringer\Types\Dict
    public function setSovereignty($sovereignty)
    {
        // by Warringer\Types\Dict
        $converters = [];
        $converters['campaigns'] = function ($value) { return new Reference($value); };
        $converters['structures'] = function ($value) { return new Reference($value); };

        $func = function ($value) use ($converters) {
            $return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS);
            $return['campaigns'] = isset($value->{'campaigns'}) ? $converters['campaigns']($value->{'campaigns'}) : null;
            $return['structures'] = isset($value->{'structures'}) ? $converters['structures']($value->{'structures'}) : null;

            return $return;
        };
        $this->sovereignty = $func($sovereignty);
    }

    // by Warringer\Types\Reference
    public function setTournaments($tournaments)
    {
        $this->tournaments = new Reference($tournaments);
    }

    // by Warringer\Types\Reference
    public function setMap($map)
    {
        $this->map = new Reference($map);
    }

    // by Warringer\Types\Reference
    public function setVirtualGoodStore($virtualGoodStore)
    {
        $this->virtualGoodStore = new Reference($virtualGoodStore);
    }

    // by Warringer\Types\String
    public function setServerVersion($serverVersion)
    {
        $this->serverVersion = $serverVersion;
    }

    // by Warringer\Types\Reference
    public function setWars($wars)
    {
        $this->wars = new Reference($wars);
    }

    // by Warringer\Types\Reference
    public function setIncursions($incursions)
    {
        $this->incursions = new Reference($incursions);
    }

    // by Warringer\Types\Reference
    public function setRaces($races)
    {
        $this->races = new Reference($races);
    }

    // by Warringer\Types\Reference
    public function setAuthEndpoint($authEndpoint)
    {
        $this->authEndpoint = new Reference($authEndpoint);
    }

    // by Warringer\Types\Dict
    public function setServiceStatus($serviceStatus)
    {
        // by Warringer\Types\Dict
        $converters = [];
        $converters['dust'] = function ($value) { return $value; };
        $converters['eve'] = function ($value) { return $value; };
        $converters['server'] = function ($value) { return $value; };

        $func = function ($value) use ($converters) {
            $return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS);
            $return['dust'] = isset($value->{'dust'}) ? $converters['dust']($value->{'dust'}) : null;
            $return['eve'] = isset($value->{'eve'}) ? $converters['eve']($value->{'eve'}) : null;
            $return['server'] = isset($value->{'server'}) ? $converters['server']($value->{'server'}) : null;

            return $return;
        };
        $this->serviceStatus = $func($serviceStatus);
    }

    // by Warringer\Types\Dict
    public function setUserCounts($userCounts)
    {
        // by Warringer\Types\Dict
        $converters = [];
        $converters['dust'] = function ($value) { return $value; };
        $converters['eve'] = function ($value) { return $value; };

        $func = function ($value) use ($converters) {
            $return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS);
            $return['dust'] = isset($value->{'dust'}) ? $converters['dust']($value->{'dust'}) : null;
            $return['eve'] = isset($value->{'eve'}) ? $converters['eve']($value->{'eve'}) : null;

            return $return;
        };
        $this->userCounts = $func($userCounts);
    }

    // by Warringer\Types\Dict
    public function setIndustry($industry)
    {
        // by Warringer\Types\Dict
        $converters = [];
        $converters['facilities'] = function ($value) { return new Reference($value); };
        $converters['systems'] = function ($value) { return new Reference($value); };

        $func = function ($value) use ($converters) {
            $return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS);
            $return['facilities'] = isset($value->{'facilities'}) ? $converters['facilities']($value->{'facilities'}) : null;
            $return['systems'] = isset($value->{'systems'}) ? $converters['systems']($value->{'systems'}) : null;

            return $return;
        };
        $this->industry = $func($industry);
    }

    // by Warringer\Types\Dict
    public function setClients($clients)
    {
        // by Warringer\Types\Dict
        $converters = [];
        $converters['dust'] = function ($value) { return new Reference($value); };
        $converters['eve'] = function ($value) { return new Reference($value); };

        $func = function ($value) use ($converters) {
            $return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS);
            $return['dust'] = isset($value->{'dust'}) ? $converters['dust']($value->{'dust'}) : null;
            $return['eve'] = isset($value->{'eve'}) ? $converters['eve']($value->{'eve'}) : null;

            return $return;
        };
        $this->clients = $func($clients);
    }

    // by Warringer\Types\Reference
    public function setTime($time)
    {
        $this->time = new Reference($time);
    }

    // by Warringer\Types\Reference
    public function setMarketTypes($marketTypes)
    {
        $this->marketTypes = new Reference($marketTypes);
    }

    // by Warringer\Types\String
    public function setServerName($serverName)
    {
        $this->serverName = $serverName;
    }
}


text:
package modules.data.transform;

import java.util.List;

import org.apache.spark.api.java.function.Function;

public class Mappers {

	public static Function<Iterable<List<String>>, Iterable<List<String>>> preMapJoinContext = new Function<Iterable<List<String>>, Iterable<List<String>>>() {
		@Override
		public Iterable<List<String>> call(Iterable<List<String>> v1) throws Exception {

			for (List<String> l : v1) {
				String rtnStr = "";
				for (String s : l) {
					if (!rtnStr.equals("")) {
						rtnStr = rtnStr.concat(",");
					}
					rtnStr = rtnStr.concat(s);
				}
				l.clear();
				l.add(rtnStr);
			}
			for (List<String> l : v1) {

				l.get(0);
			}

			return v1;
		}
	};
}


text:
/*global ColorThief*/

import app from 'flarum/app';
import User from 'flarum/models/User';
import md5 from 'smachi/gravatar/helpers/md5';

app.initializers.add('smachi-gravatar', () =>  {

	User.prototype.avatarUrl = function() {

		if (!this.attribute('avatarUrl')) {

			let profile = 'https://www.gravatar.com/' + md5(this.attribute('email')) + '.json',
				user = this;

			// Check if the user has a gravar profile
			m.request({
				dataType: 'jsonp',
				url: profile,
				deserialize: function(value) {
					return value;
				},
			})
			.then(function(data) {

				// Gravatar found, add it to the user
				user.pushAttributes({
					avatarUrl: 'https://www.gravatar.com/avatar/' + md5(user.attribute('email')) + '.jpg'
				});

			}, function(error) {

				// Load the default avatar saved locally
				let defaultAvatar = app.forum.attribute('default_avatar') || '/extensions/smachi-gravatar/default-avatar.png';

				user.pushAttributes({
					avatarUrl: app.forum.attribute('baseUrl') + defaultAvatar
				});

			});

		}

		return this.attribute('avatarUrl');
	};

	User.prototype.calculateAvatarColor = function() {

		// Avoid the cross-origin error trying to get colors from remote image
		if ( this.attribute('avatarUrl').indexOf( app.forum.attribute('baseUrl') ) === -1 ) {
			return false;
		}

		const image = new Image();
		const user = this;

		image.onload = function() {
			const colorThief = new ColorThief();
			user.avatarColor = colorThief.getColor(this);
			user.freshness = new Date();
			m.redraw();
		};
		image.src = this.avatarUrl();

	};

});


text:
//---------------------------------------------------------------------------//
/*!
 * \file Partioner.hpp
 * \author Stuart R. Slattery
 * \brief Mesh partitioner declaration.
 */
//---------------------------------------------------------------------------//

#ifndef MCLSEXAMPLES_PARTITIONER_HPP
#define MCLSEXAMPLES_PARTITIONER_HPP

#include <Teuchos_RCP.hpp>
#include <Teuchos_Comm.hpp>
#include <Teuchos_ParameterList.hpp>
#include <Teuchos_Array.hpp>
#include <Teuchos_ArrayView.hpp>

namespace MCLSExamples
{

class Partitioner
{
  public:

    //@{
    //! Typedefs.
    typedef unsigned int                          size_type;
    typedef unsigned long                         long_type;
    typedef std::vector<double>                   VecDbl;
    typedef std::pair<size_type,size_type>        SizePair;
    typedef std::pair<long_type,long_type>        LongPair;
    typedef std::pair<double,double>              DblPair;
    typedef std::pair<VecDbl, VecDbl>             VecPair;
    typedef Teuchos::Comm<int>                    CommType;
    typedef Teuchos::RCP<const CommType>          RCP_Comm;
    typedef Teuchos::RCP<Teuchos::ParameterList>  RCP_ParameterList;
    //@}

    // Constructor.
    Partitioner( const RCP_Comm &comm, const RCP_ParameterList &plist );

    // Destructor.
    ~Partitioner();

    //! Get the number of blocks.
    const SizePair& getNumBlocks() const
    { return d_num_blocks; }

    //! Get my block ids.
    const SizePair& getMyBlocks() const
    { return d_my_blocks; }

    //! Get the global edge vectors.
    const VecPair& getGlobalEdges() const
    { return d_global_edges; }

    //! Get the i-indices (vertex-based global ids).
    Teuchos::ArrayView<int> getLocalI()
    { return d_local_i(); }

    //! Get the j-indices (vertex-based global ids).
    Teuchos::ArrayView<int> getLocalJ()
    { return d_local_j(); }

    //! Get the local rows (vertex-based global ids).
    Teuchos::ArrayView<int> getLocalRows()
    { return d_local_rows(); }

    //! Get the ghosted global rows (for output).
    Teuchos::ArrayView<int> getGhostLocalRows()
    { return d_ghost_local_rows(); }

    //! Get the cell sizes.
    std::pair<double,double> getCellSizes()
    { return d_cell_size; }

  private:

    // Number of blocks.
    SizePair d_num_blocks;

    // My block ids.
    SizePair d_my_blocks;

    // Global edge vectors.
    VecPair d_global_edges;

    // Cell size.
    std::pair<double,double> d_cell_size;

    // Local i-indices (vertex-based global ids).
    Teuchos::Array<int> d_local_i;

    // Local j-indices (vertex-based global ids).
    Teuchos::Array<int> d_local_j;

    // Local rows (vertex-based global ids).
    Teuchos::Array<int> d_local_rows;

    // Ghosted local rows (for output).
    Teuchos::Array<int> d_ghost_local_rows;
};

} // end namespace MCLSExamples

#endif // end MCLSEXAMPLES_PARTITIONER_HPP

//---------------------------------------------------------------------------//
// end Partitioner.hpp
//---------------------------------------------------------------------------//


text:
import React, { PropTypes } from 'react';
import Select from 'react-select';

const Search = props => {
  const options = props.artistsAndLabels.map((artistOrLabel, index) => ({
    value: index,
    label: artistOrLabel.title,
  }));
  return (
    <Select
      autoblur
      options={options}
      onInputChange={props.onSearchFor}
      onChange={props.onGetReleases}
      placeholder="Search for artist or label.."
      scrollMenuIntoView={false}
    />
  );
};

Search.propTypes = {
  artistsAndLabels: PropTypes.array.isRequired,
  onSearchFor: PropTypes.func.isRequired,
  onGetReleases: PropTypes.func.isRequired,
};

export default Search;


text:
/* $Id: VBoxStubBld.cpp $ */
/** @file
 * VBoxStubBld - VirtualBox's Windows installer stub builder.
 */

/*
 * Copyright (C) 2009-2015 Oracle Corporation
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License (GPL) as published by the Free Software
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 */

/*******************************************************************************
*   Header Files                                                               *
*******************************************************************************/
#include <windows.h>
#include <shellapi.h>
#include <strsafe.h>

#include <VBox/version.h>

#include "VBoxStubBld.h"

HRESULT GetFile (const char* pszFilePath,
                 HANDLE* phFile,
                 DWORD* pdwFileSize)
{
    HRESULT hr = S_OK;
    *phFile = ::CreateFile(pszFilePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
    if (INVALID_HANDLE_VALUE == *phFile)
    {
        hr = HRESULT_FROM_WIN32(GetLastError());
    }
    else
    {
        *pdwFileSize = ::GetFileSize(*phFile, NULL);
        if (!*pdwFileSize)
        {
            hr = HRESULT_FROM_WIN32(GetLastError());
        }
    }
    return hr;
}

HRESULT UpdateResource(HANDLE hFile,
                       const char* pszFilePath,
                       DWORD dwFileSize,
                       HANDLE hResourceUpdate,
                       const char* szResourceType,
                       const char* szResourceId)
{
    HRESULT hr = S_OK;
    PVOID pvFile = NULL;
    HANDLE hMap = NULL;

    hMap = ::CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
    pvFile = ::MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, dwFileSize);
    if (!::UpdateResourceA(hResourceUpdate, szResourceType, szResourceId,
                           MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), pvFile, dwFileSize))
    {
        hr = HRESULT_FROM_WIN32(GetLastError());
    }

    if (pvFile)
    {
        ::UnmapViewOfFile(pvFile);
        pvFile = NULL;
    }

    if (hMap)
    {
        ::CloseHandle(hMap);
        hMap = NULL;
    }

    return hr;
}

HRESULT IntegrateFile (HANDLE hResourceUpdate,
                       const char* szResourceType,
                       const char* szResourceId,
                       const char* pszFilePath)
{
    HRESULT hr = S_OK;
    HANDLE hFile = INVALID_HANDLE_VALUE;
    DWORD dwFileSize = 0;

    do
    {
        hr = GetFile(pszFilePath, &hFile, &dwFileSize);
        if (FAILED(hr))
        {
            hr = HRESULT_FROM_WIN32(GetLastError());
            break;
        }
        else
        {
            hr = UpdateResource(hFile, pszFilePath, dwFileSize,
                                hResourceUpdate, szResourceType, szResourceId);
            if (FAILED(hr))
            {
                printf("ERROR: Error updating resource for file %s!", pszFilePath);
                break;
            }
        }

    } while (0);

    if (INVALID_HANDLE_VALUE != hFile)
    {
        ::CloseHandle(hFile);
        hFile = INVALID_HANDLE_VALUE;
    }

    return hr;
}

static char * MyPathFilename(const char *pszPath)
{
    const char *psz = pszPath;
    const char *pszName = pszPath;

    for (;; psz++)
    {
        switch (*psz)
        {
            /* handle separators. */
            case ':':
                pszName = psz + 1;
                break;

            case '\\':
            case '/':
                pszName = psz + 1;
                break;

            /* the end */
            case '\0':
                if (*pszName)
                    return (char *)(void *)pszName;
                return NULL;
        }
    }

    /* will never get here */
    return NULL;
}

int main (int argc, char* argv[])
{
    HRESULT hr = S_OK;
    int rc = 0;

    char szSetupStub[_MAX_PATH] = {"VBoxStub.exe"};
    char szOutput[_MAX_PATH] = {"VirtualBox-MultiArch.exe"};
    HANDLE hUpdate = NULL;

    do
    {
        printf(VBOX_PRODUCT " Stub Builder v%d.%d.%d.%d\n",
               VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR, VBOX_VERSION_BUILD, VBOX_SVN_REV);

        if (argc < 2)
            printf("WARNING: No parameters given! Using default values!\n");

        VBOXSTUBBUILDPKG stbBuildPkg[VBOXSTUB_MAX_PACKAGES] = {0};
        VBOXSTUBPKG stbPkg[VBOXSTUB_MAX_PACKAGES] = {0};
        VBOXSTUBPKGHEADER stbHeader =
        {
            "vbox$tub",    /* File magic. */
            1,             /* Version. */
            0              /* No files yet. */
        };

        for (int i=1; i<argc; i++)
        {
            if (0 == stricmp(argv[i], "-out") && argc > i+1)
            {
                hr = ::StringCchCopy(szOutput, _MAX_PATH, argv[i+1]);
                i++;
            }

            else if (0 == stricmp(argv[i], "-stub") && argc > i+1)
            {
                hr = ::StringCchCopy(szSetupStub, _MAX_PATH, argv[i+1]);
                i++;
            }

            else if (0 == stricmp(argv[i], "-target-all") && argc > i+1)
            {
                hr = ::StringCchCopy(stbBuildPkg[stbHeader.byCntPkgs].szSourcePath, _MAX_PATH, argv[i+1]);
                stbBuildPkg[stbHeader.byCntPkgs].byArch = VBOXSTUBPKGARCH_ALL;
                stbHeader.byCntPkgs++;
                i++;
            }

            else if (0 == stricmp(argv[i], "-target-x86") && argc > i+1)
            {
                hr = ::StringCchCopy(stbBuildPkg[stbHeader.byCntPkgs].szSourcePath, _MAX_PATH, argv[i+1]);
                stbBuildPkg[stbHeader.byCntPkgs].byArch = VBOXSTUBPKGARCH_X86;
                stbHeader.byCntPkgs++;
                i++;
            }

            else if (0 == stricmp(argv[i], "-target-amd64") && argc > i+1)
            {
                hr = ::StringCchCopy(stbBuildPkg[stbHeader.byCntPkgs].szSourcePath, _MAX_PATH, argv[i+1]);
                stbBuildPkg[stbHeader.byCntPkgs].byArch = VBOXSTUBPKGARCH_AMD64;
                stbHeader.byCntPkgs++;
                i++;
            }
            else
            {
                printf("ERROR: Invalid parameter: %s\n", argv[i]);
                hr = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
                break;
            }
            if (FAILED(hr))
            {
                printf("ERROR: StringCchCopy failed: %#x\n", hr);
                break;
            }
        }
        if (FAILED(hr))
            break;

        if (stbHeader.byCntPkgs <= 0)
        {
            printf("ERROR: No packages defined! Exiting.\n");
            break;
        }

        printf("Stub: %s\n", szSetupStub);
        printf("Output: %s\n", szOutput);
        printf("# Packages: %d\n", stbHeader.byCntPkgs);

        if (!::CopyFile(szSetupStub, szOutput, FALSE))
        {
            hr = HRESULT_FROM_WIN32(GetLastError());
            printf("ERROR: Could not create stub loader: 0x%08x\n", hr);
            break;
        }

        hUpdate = ::BeginUpdateResource(szOutput, FALSE);

        PVBOXSTUBPKG pPackage = stbPkg;
        char szHeaderName[_MAX_PATH] = {0};
        size_t iLen = 0;

        for (BYTE i=0; i<stbHeader.byCntPkgs; i++)
        {
            printf("Integrating (Platform %d): %s\n", stbBuildPkg[i].byArch, stbBuildPkg[i].szSourcePath);

            /* Construct resource name. */
            hr = ::StringCchPrintf(pPackage->szResourceName, _MAX_PATH, "BIN_%02d", i);
            pPackage->byArch = stbBuildPkg[i].byArch;

            /* Construct final name used when extracting. */
            hr = ::StringCchCopy(pPackage->szFileName, _MAX_PATH, MyPathFilename(stbBuildPkg[i].szSourcePath));

            /* Integrate header into binary. */
            hr = ::StringCchPrintf(szHeaderName, _MAX_PATH, "HDR_%02d", i);
            hr = UpdateResource(hUpdate, RT_RCDATA, szHeaderName, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), pPackage, sizeof(VBOXSTUBPKG));

            /* Integrate file into binary. */
            hr = IntegrateFile(hUpdate, RT_RCDATA, pPackage->szResourceName, stbBuildPkg[i].szSourcePath);
            if (FAILED(hr))
            {
                printf("ERROR: Could not integrate binary %s (%s): 0x%08x\n",
                         pPackage->szResourceName, pPackage->szFileName, hr);
                rc = 1;
            }

            pPackage++;
        }

        if (FAILED(hr))
            break;

        if (!::UpdateResource(hUpdate, RT_RCDATA, "MANIFEST", MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), &stbHeader, sizeof(VBOXSTUBPKGHEADER)))
        {
            hr = HRESULT_FROM_WIN32(GetLastError());
            break;
        }

        if (!::EndUpdateResource(hUpdate, FALSE))
        {
            hr = HRESULT_FROM_WIN32(GetLastError());
            break;
        }

        printf("Integration done!\n");

    } while (0);

    hUpdate = NULL;

    if (FAILED(hr))
    {
        printf("ERROR: Building failed! Last error: %d\n", GetLastError());
        rc = 1;
    }
    return rc;
}


text:
#pragma once

#include "mcrouter/lib/Operation.h"
#include "mcrouter/proxy.h"
#include "mcrouter/ProxyRequestContext.h"
#include "mcrouter/routes/McrouterRouteHandle.h"

namespace facebook { namespace memcache { namespace mcrouter {

/**
 * Same as NullRoute, but with Mcrouter stats reporting.
 */
class DevNullRoute {
 public:
  using ContextPtr = std::shared_ptr<ProxyRequestContext>;

  static std::string routeName() { return "devnull"; }

  template <class Operation, class Request>
  std::vector<McrouterRouteHandlePtr> couldRouteTo(
    const Request& req, Operation, const ContextPtr& ctx) const {

    return {};
  }

  template <class Operation, class Request>
  static typename ReplyType<Operation, Request>::type
  route(const Request& req, Operation, const ContextPtr& ctx) {

    stat_incr(ctx->proxy().stats, dev_null_requests_stat, 1);
    using Reply = typename ReplyType<Operation, Request>::type;
    return Reply(DefaultReply, Operation());
  }
};

}}}  // facebook::memcache::mcrouter


text:
angular.module('logo').directive('commandPicker', function () {
    return {
        templateUrl: 'logo/commandPicker.directive.tpl.html'
//        template: 'HELLO!'
    };
});


text:
package astext

// extensions for ast that could live upstream

// Comment is a comment.
type Comment struct {
	Text string // represents a single line comment
}


text:
<?php

namespace App\Service;

class ToS
{
    public static function translate($tosId) {
        switch($tosId) {
            case 1:
                return self::$IN_PERSON; //the user can interact physically with the employee
            case 2:
                return self::$LIVE_CHAT; //the user will interact with the chat app
            default:
                return self::$INVALID; //exception! :P
        }
    }

    public static $LIVE_CHAT = 'LiveChat';
    public static $IN_PERSON = 'InPerson';
    public static $INVALID = 'invalid';

    public static function getValues(){
        return [
            self::$IN_PERSON,
            self::$LIVE_CHAT
        ];
    }

    public static function translateToGreek($tosId) {
        if ($tosId == 1) {
            return 'Προσωπική Διεπαφή';
        } else {
            return 'Ηλεκτρονική Βοήθεια';
        }
    }
}


text:
{-# LANGUAGE OverloadedStrings #-}

module Pcc where

import Prelude hiding (takeWhile)
import Control.Monad(liftM)
import Control.Applicative hiding (many)
import Text.Parsec.Char
import Text.Parsec.Prim hiding ((<|>))
import Fs
import Common

-- store the path of a given reference file.
data Lookup = Lookup { location :: Location
                     , filename :: String } deriving Show

-- PCC tags (raw).
data PCCTag = PCCDataTag String String
            | PCCBodyTag Lookup
            | PCCComment String
            | PCCInvert PCCTag
              deriving Show

type PCCTags = [PCCTag]

parseComment :: PParser PCCTag
parseComment = liftM PCCComment parseCommentLine

parseDataTag :: PParser PCCTag
parseDataTag = do
  k <- allCaps
  _ <- char ':'
  v <- restOfLine
  return $ PCCDataTag k v

linkLocation :: Char -> Location
linkLocation '@' = Data
linkLocation '&' = Vendor
linkLocation _ = Any

parseBodyTag :: PParser PCCTag
parseBodyTag = do
  _ <- labeled "PCC:"
  l <- oneOf "@&*"
  v <- restOfLine
  return $ PCCBodyTag Lookup { location = linkLocation l,
                               filename = v }

parseInversion :: PParser PCCTag
parseInversion = PCCInvert <$> (char '!' >> parseDataTag)

parsePCCLine :: PParser PCCTags
parsePCCLine = many $ parseLine <* many newline where
  parseLine = parseBodyTag
          <|> parseDataTag
          <|> parseInversion
          <|> parseComment

parsePCC :: FilePath -> IO PCCTags
parsePCC pccName = do
  contents <- readContents pccName
  --print $ "** parsing PCC: " ++ pccName
  return $ parseResult parsePCCLine pccName contents


text:
<?php

namespace mageekguy\atoum\tests\units\asserters;

require __DIR__ . '/../../runner.php';

use
	mageekguy\atoum,
	mageekguy\atoum\php,
	mageekguy\atoum\asserters\phpFunction as sut
;

class phpFunction extends atoum\test
{
	public function testClass()
	{
		$this->testedClass->extends('mageekguy\atoum\asserters\adapter\call');
	}

	public function testSetWithTest()
	{
		$this
			->mockGenerator->orphanize('asserterFail')
			->if($asserter = new sut(new \mock\mageekguy\atoum\asserter\generator()))
			->and($test = $this)
			->then
				->exception(function() use ($asserter, $test) { $asserter->setWithTest($test); })
					->isInstanceOf('mageekguy\atoum\exceptions\logic')
					->hasMessage('Function is undefined')
			->if($asserter->setWith($function = uniqid()))
			->then
				->object($asserter->disableEvaluationChecking()->setWithTest($this))->isIdenticalTo($asserter)
				->object($asserter->getAdapter())->isCloneOf(php\mocker::getAdapter())
				->string($asserter->getCall()->getFunction())->isEqualTo($this->getTestedClassNamespace() . '\\' . $function)
		;
	}

	public function testSetWith()
	{
		$this
			->mockGenerator->orphanize('asserterFail')
			->if($asserter = new sut(new \mock\mageekguy\atoum\asserter\generator()))
			->then
				->object($asserter->disableEvaluationChecking()->setWith($function = uniqid()))->isIdenticalTo($asserter)
				->object($asserter->getAdapter())->isCloneOf(php\mocker::getAdapter())
				->string($asserter->getCall()->getFunction())->isEqualTo($function)
		;
	}

	public function testWasCalled()
	{
		$this
			->mockGenerator->orphanize('asserterFail')
			->if($asserter = new sut(new \mock\mageekguy\atoum\asserter\generator()))
			->then
				->exception(function() use ($asserter) { $asserter->wasCalled(); })
					->isInstanceOf('mageekguy\atoum\exceptions\logic')
					->hasMessage('Function is undefined')
			->if($asserter->setWith(uniqid()))
			->then
				->object($asserter->wasCalled())->isIdenticalTo($asserter)
				->variable($asserter->getCall()->getArguments())->isNull()
			->if($asserter->disableEvaluationChecking()->wasCalledWithArguments(array()))
			->then
				->object($asserter->wasCalled())->isIdenticalTo($asserter)
				->variable($asserter->getCall()->getArguments())->isNull()
		;
	}

	public function testWasCalledWithArguments()
	{
		$this
			->if($asserter = new sut(new atoum\asserter\generator()))
			->then
				->exception(function() use ($asserter) { $asserter->wasCalledWithArguments(); })
					->isInstanceOf('mageekguy\atoum\exceptions\logic')
					->hasMessage('Function is undefined')
			->if($this->function->md5 = uniqid())
			->and($asserter->setWith('md5'))
			->and($asserter->setWithTest($this))
			->then
				->object($asserter->wasCalledWithArguments($arg1 = '1', $arg2 = '2'))->isIdenticalTo($asserter)
				->array($asserter->getCall()->getArguments())->isEqualTo(array($arg1, $arg2))
			->if(eval('\\' . $this->getTestedClassNamespace() . '\md5(\'' . $arg1 . '\', \'' . $arg2 . '\');'))
			->then
				->exception(function() use ($asserter) { $asserter->once(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
			->if($asserter->setWith('md5'))
			->and($asserter->setWithTest($this))
			->then
				->object($asserter->once())->isIdenticalTo($asserter)
			->if(eval('\\' . $this->getTestedClassNamespace() . '\md5(1, 2);'))
			->if($asserter->setWith('md5'))
			->and($asserter->setWithTest($this))
			->then
				->object($asserter->twice())->isIdenticalTo($asserter)
		;
	}

	public function testWasCalledWithIdenticalArguments()
	{
		$this
			->if($asserter = new sut(new atoum\asserter\generator()))
			->then
				->exception(function() use ($asserter) { $asserter->wasCalledWithIdenticalArguments(); })
					->isInstanceOf('mageekguy\atoum\exceptions\logic')
					->hasMessage('Function is undefined')
			->if($this->function->md5 = uniqid())
			->and($asserter->setWith('md5'))
			->and($asserter->setWithTest($this))
			->then
				->object($asserter->wasCalledWithIdenticalArguments($arg1 = '1', $arg2 = '2'))->isIdenticalTo($asserter)
				->array($asserter->getCall()->getArguments())->isEqualTo(array($arg1, $arg2))
			->if(eval('\\' . $this->getTestedClassNamespace() . '\md5(1, 2);'))
			->then
				->exception(function() use ($asserter) { $asserter->once(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
				->exception(function() use ($asserter) { $asserter->twice(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
		;
	}

	public function testWasCalledWithAnyArguments()
	{
		$this
			->mockGenerator->orphanize('asserterFail')
			->if($asserter = new sut(new \mock\mageekguy\atoum\asserter\generator()))
			->then
				->exception(function() use ($asserter) { $asserter->wasCalledWithAnyArguments(); })
					->isInstanceOf('mageekguy\atoum\exceptions\logic')
					->hasMessage('Function is undefined')
			->if($asserter->setWith(uniqid()))
			->and($asserter->disableEvaluationChecking()->wasCalledWithArguments(array()))
			->then
				->object($asserter->wasCalledWithAnyArguments())->isIdenticalTo($asserter)
				->variable($asserter->getCall()->getArguments())->isNull()
		;
	}

	public function testWasCalledWithoutAnyArguments()
	{
		$this
			->mockGenerator->orphanize('asserterFail')
			->if($asserter = new sut(new \mock\mageekguy\atoum\asserter\generator()))
			->then
				->exception(function() use ($asserter) { $asserter->wasCalledWithoutAnyArgument(); })
					->isInstanceOf('mageekguy\atoum\exceptions\logic')
					->hasMessage('Function is undefined')
			->if($asserter->setWith(uniqid()))
			->and($asserter->wasCalledWithArguments(array()))
			->then
				->object($asserter->disableEvaluationChecking()->wasCalledWithoutAnyArgument())->isIdenticalTo($asserter)
				->array($asserter->getCall()->getArguments())->isEmpty()
		;
	}
}


text:
<?php namespace Flamingo\Fluent;

use Flamingo\Fluent\Contract\Renderable;

abstract class BaseWidget implements Renderable {

    /**
     * Widget tag name.
     *
     * @var string
     */
    protected $tagName = '';

    /**
     * Widget parameters.
     *
     * @var array
     */
    protected $params = [];

    /**
     * Get widget tag name.
     *
     * @return string
     */
    public function getTagName()
    {
        return $this->tagName;
    }

    /**
     * Set widget tag name.
     *
     * @param  string $tagName
     * @return $this
     */
    public function tag($tagName)
    {
        $this->tagName = $tagName;

        return $this;
    }

    /**
     * Get rendered html parameters.
     *
     * @return string
     */
    public function getParams()
    {
        return $this->buildParams($this->params);
    }

    /**
     * Set parameter.
     *
     * @param  string $name
     * @param  string $value
     * @return $this
     */
    public function param($name, $value)
    {
        $this->params[$name] = $value;

        return $this;
    }

    /**
     * Set parameters.
     *
     * @param  array $params
     * @return $this
     */
    public function params($params)
    {
        $this->params = $params;

        return $this;
    }

    /**
     * Concat parameters.
     *
     * @param  array
     * @return string
     */
    protected function buildParams(array $params)
    {
        return implode(' ', array_map(function($k, $v) {
            return "{$k}=\"{$v}\"";
        }, array_keys($params), array_values($params)));
    }

    /**
     * {@inheritdoc}
     */
    abstract public function render();

    /**
     * Set value.
     *
     * @param  string $value
     * @return $this
     */
    abstract public function value($value);
}


text:
/* eslint-disable no-use-before-define, no-console, class-methods-use-this */
/* globals HTMLElement, window */
import render from './render';

class BlueBasket extends HTMLElement {
  connectedCallback() {
    this.refresh = this.refresh.bind(this);
    this.log('connected');
    this.render();
    window.addEventListener('blue:basket:changed', this.refresh);
  }

  refresh() {
    this.log('event recieved "blue:basket:changed"');
    this.render();
  }

  render() {
    this.innerHTML = render(window.blue.count);
  }

  disconnectedCallback() {
    window.removeEventListener('blue:basket:changed', this.refresh);
    this.log('disconnected');
  }

  log(...args) {
    console.log('🛒 blue-basket', ...args);
  }
}

export default BlueBasket;


text:
/*
	This code tests the sin_to_string() function implementation.
 */

#include "condor_common.h"
#include "condor_debug.h"
#include "condor_config.h"
#include "internet.h"
#include "function_test_driver.h"
#include "emit.h"
#include "unit_test_utils.h"

static bool test_normal_case(void);

bool FTEST_string_to_port(void) {
		// beginning junk for getPortFromAddr(() {
	emit_function("int string_to_port(const char* addr)");
	emit_comment("Gets and returns the port number from a sinful string");
	emit_problem("Function does no error checking on the port number");

		// driver to run the tests and all required setup
	FunctionDriver driver;
	driver.register_function(test_normal_case);

		// run the tests
	return driver.do_all_functions();
}

static bool test_normal_case() {
	emit_test("Is normal input converted correctly?");
	char* input = strdup( "<192.168.255.0:35>" );
	int result = string_to_port(input);
	emit_input_header();
	emit_param("STRING", input);
	free(input);
	emit_output_expected_header();
	emit_retval("35");
	emit_output_actual_header();
	emit_retval("%d", result);
	if(result != 35) {
		FAIL;
	}
	PASS;
}


text:
using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using Debug = UnityEngine.Debug;
using jsval = JSApi.jsval;
/// <summary>
/// JSEngine
/// Represents a JavaScript Engine object
/// In order to run JavaScript, there must be one and only one JSEngine object in the scene
///
/// JSEngine must have a lower execution order than JSComponent.
/// You can set script execution order by click menu Edit | Project Settings | Script Execution Order
/// for example, set JSEngine to 400, set JSComponent to 500
/// </summary>
public class JSEngine : MonoBehaviour
{
    public static JSEngine inst;
    public static int initState = 0;
    public static bool initSuccess { get { return initState == 1; } set { if (value) initState = 1; } }
    public static bool initFail { get { return initState == 2; } set { if (value) initState = 2; else initState = 0; } }

    /*
     * Debug settings, if port is not available, try another one
     */
	public bool UseJSC = false;
    public bool debug = true;
    public int port = 5086;
    bool mDebug = true;

    /*
     * Garbage Collection setting
     * if GCInterval < 0, will not call GC (default value, SpiderMonkey will automatically call GC)
     * if GCInterval >= 0, will call GC every GCInterval seconds
     */
    public float GCInterval = -1f;

    /*
     *
     */
    public string[] InitLoadScripts = new string[0];

    public void OnInitJSEngine(bool bSuccess)
    {
        /*
         * Debugging is only available in desktop platform
         * */
        mDebug = debug && UseJSC;
        if (bSuccess)
        {
            if (InitLoadScripts != null)
            {
                for (var i = 0; i < InitLoadScripts.Length; i++)
                {
                    JSMgr.evaluate(InitLoadScripts[i]);
                }
            }

            if (JSApi.initErrorHandler() == 1)
                Debug.Log("JS: print error stack: YES");
            else
                Debug.Log("JS: print error stack: NO");

            initSuccess = true;
            Debug.Log("JS: Init JSEngine OK");
            if (mDebug)
            {
                Debug.Log("JS: Enable Debugger");
                JSApi.enableDebugger(new string[] { JSPathSettings.jsDir }, 1, port);
            }
            //获取Manual/UnityEngine_MonoBehaviour下定义的jsb_UpdateJsCom全局方法
            idUpdateEvent = JSApi.getObjFunction(0, "jsb_UpdateJsCom");
            if (idUpdateEvent <= 0)
            {
                Debug.LogError("Can not find JsFunction[jsb_UpdateJsCom]");
            }
            idLateUpdateEvent = JSApi.getObjFunction(0, "jsb_LateUpdateJsCom");
            if (idLateUpdateEvent <= 0)
            {
                Debug.LogError("Can not find JsFunction[jsb_LateUpdateJsCom]");
            }
            idFixedUpdateEvent = JSApi.getObjFunction(0, "jsb_FixedUpdateJsCom");
            if (idFixedUpdateEvent <= 0)
            {
                Debug.LogError("Can not find JsFunction[jsb_FixedUpdateJsCom]");
            }
        }
        else
        {
            initFail = true;
            Debug.Log("JS: Init JSEngine FAIL");
        }
    }

    // FirstInit may be called from JSComponent!
    public static void FirstInit(JSEngine jse = null)
    {
        if (!initSuccess && !initFail)
        {
            if (jse == null)
            {
                GameObject jseGO = GameObject.Find("JSEngine");
                if (jseGO == null)
                {
                    initFail = true;
                    Debug.LogError("JSEngine gameObject not found.");
                }
                else
                {
                    jse = jseGO.GetComponent<JSEngine>();
                }
            }

            if (jse != null)
            {
                /*
                * Don't destroy this GameObject on load
                */
                DontDestroyOnLoad(jse.gameObject);
                inst = jse;
#if UNITY_EDITOR
                //编辑器模式下默认输出JSEngine统计数据
                inst.showStatistics = true;
#endif

                Stopwatch stopwatch = Stopwatch.StartNew();
                JSMgr.InitJSEngine(jse.OnInitJSEngine);
                stopwatch.Stop();
                Debug.Log("==============InitJSEngine: " + stopwatch.ElapsedMilliseconds + " ms");
            }
        }
    }

    void Awake()
    {
        if (JSEngine.inst != null && JSEngine.inst != this)
        {
            // destroy self if there is already a JSEngine gameObject
            Destroy(gameObject);
            return;
        }

		Debug.Log (UseJSC ? "JS: Use JSC" : "JS: Not Use JSC");
        JSEngine.FirstInit(this);
    }

    private int jsCallCSPerFrame = 0;
#if UNITY_EDITOR
    private string jsCallLogInfo = "";
#endif
    void Update()
    {
        if (this != JSEngine.inst)
            return;

        jsCallCSPerFrame = JSMgr.vCall.jsCallCount;
        JSMgr.vCall.jsCallCount = 0;
#if UNITY_EDITOR
        if (JSMgr.vCall.jsCallInfoSb.Length > 0)
        {
            jsCallLogInfo = JSMgr.vCall.jsCallInfoSb.ToString();
            JSMgr.vCall.jsCallInfoSb.Length = 0;
        }
#endif

        UpdateThreadSafeActions();

        if (initSuccess)
        {
            _UpdateEvent();
            if (mDebug)
                JSApi.updateDebugger();
        }
    }

    #region JsCom UpdateEvent
    private int idUpdateEvent;
    private int idLateUpdateEvent;
    private int idFixedUpdateEvent;
    private void _UpdateEvent()
    {
        if (idUpdateEvent > 0)
        {
            JSMgr.vCall.CallJSFunctionValue(0, idUpdateEvent);
        }
    }

    private void _LateUpdateEvent()
    {
        if (idLateUpdateEvent > 0)
        {
            JSMgr.vCall.CallJSFunctionValue(0, idLateUpdateEvent);
        }
    }

    private void _FixedUpdateEvent()
    {
        if (idFixedUpdateEvent > 0)
        {
            JSMgr.vCall.CallJSFunctionValue(0, idFixedUpdateEvent);
        }
    }

    public void DumpJsComMapInfo()
    {
        if (!Application.isPlaying)
            return;

        if (initSuccess)
        {
            JSMgr.vCall.CallJSFunctionName(0, "jsb_DumpJsComMapInfo");
        }
    }
    #endregion

    List<Action> lstThreadSafeActions = new List<Action>();
    bool hasThreadSafeActions = false;
    object @lock = new object();

    public void DoThreadSafeAction(Action action)
    {
        lock (@lock)
        {
            hasThreadSafeActions = true;
            lstThreadSafeActions.Add(action);
        }
    }
    private void UpdateThreadSafeActions()
    {
        if (hasThreadSafeActions)
        {
            lock (@lock)
            {
                for (int i = 0; i < lstThreadSafeActions.Count; i++)
                {
                    Action action = lstThreadSafeActions[i];
                    if(action != null)
                        action();
                }
                lstThreadSafeActions.Clear();
                hasThreadSafeActions = false;
            }
        }
    }

    float accum = 0f;
    void LateUpdate()
    {
        if (this != JSEngine.inst)
            return;

        if (initSuccess)
        {
            _LateUpdateEvent();
            if (GCInterval >= 0f)
            {
                accum += Time.deltaTime;
                if (accum > GCInterval)
                {
                    accum = 0f;
                    //Debug.Log("_GC_Begin");
                    JSApi.gc();
                    //Debug.Log("_GC_End");
                }
            }
        }
    }

    void FixedUpdate()
    {
        if (this != JSEngine.inst)
            return;

        if (initSuccess)
        {
            _FixedUpdateEvent();
        }
    }

    void OnDestroy()
    {
        if (this == JSEngine.inst)
        {
            if (mDebug && initSuccess)
            {
                JSApi.cleanupDebugger();
            }
            JSMgr.ShutdownJSEngine();
            JSEngine.inst = null;
            JSEngine.initState = 0;
            Debug.Log("JS: JSEngine Destroy");
        }
    }

	public bool showStatistics = true;
    public Vector2 scrollPos = Vector2.zero;
#if !UNITY_EDITOR
    /// <summary>
    /// OnGUI: Output some statistics
    /// </summary>
    void OnGUI()
    {
        if (this != inst)
            return;
        if (!showStatistics)
            return;

        scrollPos = DrawStatistics(scrollPos, 280f);
    }
#endif

    public Vector2 DrawStatistics(Vector2 sliderPos,float scrollViewHeight)
    {
        int countDict1, countDict2;

        JSMgr.GetDictCount(out countDict1, out countDict2);
        GUILayout.TextArea(
            "JS->CS Count: " + jsCallCSPerFrame + " Round: " + JSMgr.jsEngineRound + " Objs(Total " + countDict1 +
            ", Class " + countDict2 + ") CSR(Obj " + CSRepresentedObject.s_objCount + " Fun " +
            CSRepresentedObject.s_funCount + ") Del " + JSMgr.getJSFunCSDelegateCount());
#if UNITY_EDITOR
        GUILayout.TextArea(jsCallLogInfo);
#endif

        int clsCount = 0;
        var dict1 = JSMgr.GetDict1();
        var Keys = new List<int>(dict1.Keys);

        var class2Count = new Dictionary<string, int>();
        foreach (int K in Keys)
        {
            if (!dict1.ContainsKey(K))
                continue;

            var Rel = dict1[K];
            var typeName = Rel.csObj.GetType().Name;
            if (class2Count.ContainsKey(typeName))
            {
                class2Count[typeName]++;
            }
            else
            {
                class2Count[typeName] = 1;
            }
            if (Rel.csObj != null && Rel.csObj.GetType().IsClass)
            {
                clsCount++;
            }
        }
        float y = 40;
        sliderPos = GUILayout.BeginScrollView(sliderPos, GUILayout.Height(scrollViewHeight));
        GUILayout.TextArea("class count: " + clsCount);
        y += 20;
        GUILayout.TextArea("valueMapSize: " + JSApi.getValueMapSize());
        y += 20;
        GUILayout.TextArea("valueMapIndex: " + JSApi.getValueMapIndex());
        y += 20;
        foreach (var v in class2Count)
        {
            GUILayout.TextArea(v.Key + ": " + v.Value);
            y += 20;
        }
        GUILayout.EndScrollView();

        return sliderPos;
    }
}


text:
//
//  GTLYouTubeGuideCategory.m
//

// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
//   YouTube Data API (youtube/v3)
// Description:
//   Programmatic access to YouTube features.
// Documentation:
//   https://developers.google.com/youtube/v3
// Classes:
//   GTLYouTubeGuideCategory (0 custom class methods, 4 custom properties)

#import "GTLYouTubeGuideCategory.h"

#import "GTLYouTubeGuideCategorySnippet.h"

// ----------------------------------------------------------------------------
//
//   GTLYouTubeGuideCategory
//

@implementation GTLYouTubeGuideCategory
@dynamic ETag, identifier, kind, snippet;

+ (NSDictionary *)propertyToJSONKeyMap {
  NSDictionary *map = @{
    @"ETag" : @"etag",
    @"identifier" : @"id"
  };
  return map;
}

+ (void)load {
  [self registerObjectClassForKind:@"youtube#guideCategory"];
}

@end


text:
module FSSH
  class ServerManager
    class << self
      def client
        @client ||= AWS::EC2::Base.new(
          :access_key_id => ENV["AMAZON_ACCESS_KEY_ID"],
          :secret_access_key => ENV["AMAZON_ACCESS_SECRET"]
        )
      end

      def instances
        @instances ||= ServerSet.new(client.describe_instances.reservationSet.item)
      end
    end
  end
end


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>set_lg_regionmax</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Getting Started with the Oracle Berkeley DB SQL APIs" />
    <link rel="up" href="configuration_reference.html" title="Appendix A. DB_CONFIG Parameter Reference" />
    <link rel="prev" href="set_lg_max_parameter.html" title="set_lg_max" />

          set_lg_regionmax

          Prev
          Appendix A. DB_CONFIG Parameter Reference

set_lg_regionmax

                 Set the size of the underlying logging area of the Berkeley DB
                 environment, in bytes.  By default, or if the value is set to 0, the
                 minimum region size is used, approximately 128KB.  The log region is
                 used to store filenames, and so may need to be increased in size if a
                 large number of files will be opened and registered with the specified
                 Berkeley DB environment's log manager.

                 The syntax of this parameter in the DB_CONFIG file is
                 a single line with the string set_lg_regionmax,
                 one or more whitespace characters, and the log region size in bytes.

                 If the database environment already exists when this parameter is
                 changed, it is ignored. To change this value after the environment
                 has been created, re-create your environment as described in
                 The DB_CONFIG File.

          Prev

            Up

          set_lg_max

            Home


text:
import ComponentView from "/apogeeview/componentdisplay/ComponentView.js";
import AceTextEditor from "/apogeeview/datadisplay/AceTextEditor.js";
import dataDisplayHelper from "/apogeeview/datadisplay/dataDisplayHelper.js";

/** This is the base class for a  basic control component. To create a
 * new control component, extend this class implementing the needed methods
 * and create a generator. */
export default class BasicComponentView extends ComponentView {

    constructor(appViewInterface,component) {
        //extend edit component
        super(appViewInterface,component);
    };

    //==============================
    // Methods to Implement
    //==============================

    //This method must be implemented
    ///** This method returns the outout data display/editor for the control */
    //getOutputDisplay(displayContainer);

    //==============================
    // Protected and Private Instance Methods
    //==============================

    /**  This method retrieves the table edit settings for this component instance
     * @protected */
    getTableEditSettings() {
        return BasicComponentView.TABLE_EDIT_SETTINGS;
    }

    /** This method should be implemented to retrieve a data display of the give type.
     * @protected. */
    getDataDisplay(displayContainer,viewType) {

        var callbacks;
        var app = this.getApp();

        //create the new view element;
        switch(viewType) {

            case BasicComponentView.VIEW_OUTPUT:
                return this.getOutputDisplay(displayContainer);

            case BasicComponentView.VIEW_CODE:
                callbacks = dataDisplayHelper.getMemberFunctionBodyDataSource(app,this,"member");
                return new AceTextEditor(displayContainer,callbacks,"ace/mode/javascript",AceTextEditor.OPTION_SET_DISPLAY_MAX);

            case BasicComponentView.VIEW_SUPPLEMENTAL_CODE:
                callbacks = dataDisplayHelper.getMemberSupplementalDataSource(app,this,"member");
                return new AceTextEditor(displayContainer,callbacks,"ace/mode/javascript",AceTextEditor.OPTION_SET_DISPLAY_MAX);

            default:
    //temporary error handling...
                console.error("unrecognized view element: " + viewType);
                return null;
        }
    }
}

//======================================
// Static properties
//======================================

BasicComponentView.VIEW_OUTPUT = "Output";
BasicComponentView.VIEW_CODE = "Code";
BasicComponentView.VIEW_SUPPLEMENTAL_CODE = "Private";

BasicComponentView.VIEW_MODES = [
	BasicComponentView.VIEW_OUTPUT,
	BasicComponentView.VIEW_CODE,
    BasicComponentView.VIEW_SUPPLEMENTAL_CODE
];

BasicComponentView.TABLE_EDIT_SETTINGS = {
    "viewModes": BasicComponentView.VIEW_MODES
}

//===============================
// External Settings
//===============================

/** This is the component name with which this view is associated. */
//BasicControlComponentView.componentName = "<insert component unique name here>";

/** If true, this indicates the component has a tab entry */
BasicComponentView.hasTabEntry = false;
/** If true, this indicates the component has an entry appearing on the parent tab */
BasicComponentView.hasChildEntry = true;

/** This is the icon url for the component. */
BasicComponentView.ICON_RES_PATH = "/componentIcons/genericControl.png";


text:
package com.google.sample.cast.refplayer.queue.ui;

import com.google.android.gms.cast.MediaQueueItem;
import com.google.android.gms.cast.MediaStatus;
import com.google.android.gms.cast.framework.CastContext;
import com.google.android.gms.cast.framework.CastSession;
import com.google.android.gms.cast.framework.media.RemoteMediaClient;
import com.google.sample.cast.refplayer.R;
import com.google.sample.cast.refplayer.expandedcontrols.ExpandedControlsActivity;
import com.google.sample.cast.refplayer.queue.QueueDataProvider;
import com.google.sample.cast.refplayer.utils.Utils;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * A fragment to show the list of queue items.
 */
public class QueueListViewFragment extends Fragment
        implements QueueListAdapter.OnStartDragListener {

    private static final String TAG = "QueueListViewFragment";
    private QueueDataProvider mProvider;
    private ItemTouchHelper mItemTouchHelper;

    public QueueListViewFragment() {
        super();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
            @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.cast_fragment_recycler_list_view, container, false);
    }

    @Override
    public void onStartDrag(RecyclerView.ViewHolder viewHolder) {
        mItemTouchHelper.startDrag(viewHolder);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        RecyclerView recyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
        mProvider = QueueDataProvider.getInstance(getContext());

        QueueListAdapter adapter = new QueueListAdapter(getActivity(), this);
        recyclerView.setHasFixedSize(true);
        recyclerView.setAdapter(adapter);
        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));

        ItemTouchHelper.Callback callback = new QueueItemTouchHelperCallback(adapter);
        mItemTouchHelper = new ItemTouchHelper(callback);
        mItemTouchHelper.attachToRecyclerView(recyclerView);

        adapter.setEventListener(new QueueListAdapter.EventListener() {
            @Override
            public void onItemViewClicked(View view) {
                switch (view.getId()) {
                    case R.id.container:
                        Log.d(TAG, "onItemViewClicked() container "
                                + view.getTag(R.string.queue_tag_item));
                        onContainerClicked(view);
                        break;
                    case R.id.play_pause:
                        Log.d(TAG, "onItemViewClicked() play-pause "
                                + view.getTag(R.string.queue_tag_item));
                        onPlayPauseClicked(view);
                        break;
                    case R.id.play_upcoming:
                        mProvider.onUpcomingPlayClicked(view,
                                (MediaQueueItem) view.getTag(R.string.queue_tag_item));
                        break;
                    case R.id.stop_upcoming:
                        mProvider.onUpcomingStopClicked(view,
                                (MediaQueueItem) view.getTag(R.string.queue_tag_item));
                        break;
                }
            }
        });
    }

    private void onPlayPauseClicked(View view) {
        RemoteMediaClient remoteMediaClient = getRemoteMediaClient();
        if (remoteMediaClient != null) {
            remoteMediaClient.togglePlayback();
        }
    }

    private void onContainerClicked(View view) {
        RemoteMediaClient remoteMediaClient = getRemoteMediaClient();
        if (remoteMediaClient == null) {
            return;
        }
        MediaQueueItem item = (MediaQueueItem) view.getTag(R.string.queue_tag_item);
        if (mProvider.isQueueDetached()) {
            Log.d(TAG, "Is detached: itemId = " + item.getItemId());

            int currentPosition = mProvider.getPositionByItemId(item.getItemId());
            MediaQueueItem[] items = Utils.rebuildQueue(mProvider.getItems());
            remoteMediaClient.queueLoad(items, currentPosition,
                    MediaStatus.REPEAT_MODE_REPEAT_OFF, null);
        } else {
            int currentItemId = mProvider.getCurrentItemId();
            if (currentItemId == item.getItemId()) {
                // We selected the one that is currently playing so we take the user to the
                // full screen controller
                CastSession castSession = CastContext.getSharedInstance(
                        getContext().getApplicationContext())
                        .getSessionManager().getCurrentCastSession();
                if (castSession != null) {
                    Intent intent = new Intent(getActivity(), ExpandedControlsActivity.class);
                    startActivity(intent);
                }
            } else {
                // a different item in the queue was selected so we jump there
                remoteMediaClient.queueJumpToItem(item.getItemId(), null);
            }
        }
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        setRetainInstance(true);
    }

    private RemoteMediaClient getRemoteMediaClient() {
        CastSession castSession =
                CastContext.getSharedInstance(getContext()).getSessionManager()
                        .getCurrentCastSession();
        if (castSession != null && castSession.isConnected()) {
            return castSession.getRemoteMediaClient();
        }
        return null;
    }
}


text:
#pragma once

#include <tuple>

#include <sqlpp17/core/clause_fwd.h>
#include <sqlpp17/core/statement.h>
#include <sqlpp17/core/tuple_to_sql_string.h>
#include <sqlpp17/core/type_traits.h>
#include <sqlpp17/core/wrapped_static_assert.h>

namespace sqlpp
{
  template <typename... Columns>
  struct order_by_t
  {
    std::tuple<Columns...> _columns;
  };
  template <typename... Columns>
  order_by_t(std::tuple<Columns...>) -> order_by_t<Columns...>;

  template <typename... Columns>
  struct nodes_of<order_by_t<Columns...>>
  {
    using type = type_vector<Columns...>;
  };

  template <typename Table>
  constexpr auto clause_tag<order_by_t<Table>> = ::std::string_view{"order_by"};

  template <typename... Columns, typename Statement>
  class clause_base<order_by_t<Columns...>, Statement>
  {
  public:
    template <typename OtherStatement>
    clause_base(const clause_base<order_by_t<Columns...>, OtherStatement>& s) : _columns(s._columns)
    {
    }

    clause_base(const order_by_t<Columns...>& f) : _columns(f._columns)
    {
    }

    std::tuple<Columns...> _columns;
  };

  SQLPP_WRAPPED_STATIC_ASSERT(assert_order_by_args_not_having_aggregates_without_group_by,
                              "order_by() args must not be aggregates if there is no group by");

  template <typename Db, typename... Columns, typename... Clauses>
  constexpr auto check_clause_preparable(const type_t<clause_base<order_by_t<Columns...>, statement<Clauses...>>>& t)
  {
    constexpr auto known_aggregates = (::sqlpp::type_vector{} + ... + provided_aggregates_of_v<Clauses>);

    if constexpr ((known_aggregates.empty() and ... and
                   recursive_contains_aggregate(known_aggregates, ::sqlpp::type_vector<Columns>{})))
    {
      return failed<assert_order_by_args_not_having_aggregates_without_group_by>{};
    }
    else
    {
      return succeeded{};
    }
  }

  template <typename Context, typename... Columns, typename Statement>
  [[nodiscard]] auto to_sql_string(Context& context, const clause_base<order_by_t<Columns...>, Statement>& t)
  {
    return std::string{" ORDER BY "} + tuple_to_sql_string(context, ", ", t._columns);
  }

  SQLPP_WRAPPED_STATIC_ASSERT(assert_order_by_args_not_empty, "order_by() must be called with at least one argument");
  SQLPP_WRAPPED_STATIC_ASSERT(assert_order_by_args_are_sort_expressions,
                              "order_by() args must be sort expressions (tab.foo.asc())");

  template <typename... T>
  constexpr auto check_order_by_arg(const T&...)
  {
    if constexpr (sizeof...(T) == 0)
    {
      return failed<assert_order_by_args_not_empty>{};
    }
    else if constexpr (!(true && ... && is_sort_order_v<T>))
    {
      return failed<assert_order_by_args_are_sort_expressions>{};
    }
    else
      return succeeded{};
  }

  struct no_order_by_t
  {
  };

  template <typename Statement>
  class clause_base<no_order_by_t, Statement>
  {
  public:
    template <typename OtherStatement>
    constexpr clause_base(const clause_base<no_order_by_t, OtherStatement>& s)
    {
    }

    constexpr clause_base() = default;

    template <typename... Expressions>
    [[nodiscard]] constexpr auto order_by(Expressions... expressions) const
    {
      if constexpr (constexpr auto _check = check_order_by_arg(expressions...); _check)
      {
        return new_statement(*this, order_by_t{std::tuple{expressions...}});
      }
      else
      {
        return ::sqlpp::bad_expression_t{_check};
      }
    }

    template <typename... Expressions>
    [[nodiscard]] constexpr auto order_by(std::tuple<Expressions...> expressions) const
    {
      if constexpr (constexpr auto _check = check_order_by_arg(std::declval<Expressions>()...); _check)
      {
        return new_statement(*this, order_by_t{expressions});
      }
      else
      {
        return ::sqlpp::bad_expression_t(_check);
      }
    }
  };

  template <typename Context, typename Statement>
  [[nodiscard]] auto to_sql_string(Context& context, const clause_base<no_order_by_t, Statement>& t)
  {
    return std::string{};
  }

  template <typename... Expressions>
  [[nodiscard]] constexpr auto order_by(Expressions&&... expressions)
  {
    return statement<no_order_by_t>{}.order_by(std::forward<Expressions>(expressions)...);
  }
}  // namespace sqlpp