text:
///////////////////////////////////////////////////////////////////////////////
//                   SOFTWARE COPYRIGHT NOTICE AGREEMENT                     //
//       This software and its documentation are copyright (2010) by the     //
//   Broad Institute.  All rights are reserved.  This software is supplied   //
//   without any warranty or guaranteed support whatsoever. The Broad        //
//   Institute is not responsible for its use, misuse, or functionality.     //
///////////////////////////////////////////////////////////////////////////////
/*
 * \file HashSet.h
 * \author tsharpe
 * \date Aug 20, 2010
 *
 * \brief Big, low-memory-overhead hash table.
 */
#ifndef FEUDAL_HASHSET_H
#define FEUDAL_HASHSET_H

#include "feudal/BinaryStream.h"
#include "feudal/Iterator.h"
#include "math/PowerOf2.h"
#include "system/Assert.h"
#include "system/SpinLockedData.h"
#include "system/WorklistN.h"
#include <algorithm>
#include <atomic>
#include <cstddef>
#include <cstring>
#include <functional>
#include <utility>

/// Hopscotch hash set needs an abstract way of producing an array of values
/// that can be used when T doesn't have a default constructor.
/// This implementation is for the simple case where you can use new and delete.
template <class T>
class TFactory
{
public:
    template <class X>
    std::allocator<X> alloc(X*) const { return std::allocator<X>(); }

    T* create( size_t nTs ) const { return new T[nTs]; }
    void destroy( T* pTs, size_t nTs ) const { delete [] pTs; }
};

// Ignore this little helper class.
// It merely subclasses some likely-to-be-empty classes so they don't take up
// extra space in the hash set classes.
/// Template args as for HopscotchHashSet, which follows.
template <class T, class H, class C = std::equal_to<T>, class F=TFactory<T> >
class HCF : public H, public C, public F
{
public:
    typedef typename H::argument_type const& key_type;

    explicit HCF( H const& h= H(), C const& c = C(), F const& f = F() )
    : H(h), C(c), F(f) {}

    // compiler-supplied copying and destructor are OK

    size_t hash( key_type val ) const
    { return static_cast<H const&>(*this)(val); }

    bool compare( key_type v1, key_type v2 ) const
    { return static_cast<C const&>(*this)(v1,v2); }

    friend void swap( HCF& hcf1, HCF& hcf2 )
    { using std::swap;
      swap(static_cast<H&>(hcf1),static_cast<H&>(hcf2));
      swap(static_cast<C&>(hcf1),static_cast<C&>(hcf2));
      swap(static_cast<F&>(hcf1),static_cast<F&>(hcf2)); }
};

class BktStatus
{
public:
    enum Status { EMPTY, HEAD, SQUATTER };

    // compiler-supplied default constructor, copying and destructor are OK

    Status getStatus() const { return static_cast<Status>(mStatus); }
    void setStatus( Status status ) { mStatus = status; }

    unsigned getOffset() const { return mOffset; }
    void setOffset( unsigned offset )
    { AssertLe(offset,maxOffset()); mOffset = offset; }

    bool hasNext() const { return mOffset; }
    BktStatus const* next() const { return this-mOffset; }
    BktStatus* next() { return this-mOffset; }

    static unsigned maxOffset() { return (1ul << 6) - 1ul; }

private:
    unsigned char mStatus : 2;
    unsigned char mOffset : 6;
};

TRIVIALLY_SERIALIZABLE(BktStatus);

// fwd decl for friend
template <class T, class H, class C, class F> class HashSet;

/// A fixed-size hash set.
/// The hopscotch algorithm provides high load factors without getting in a jam.
/// This implementation is optimized for low memory overhead: just a single
/// byte per entry.
///
/// T, the value_type, must be assignable.  It must also be default
/// constructable, unless you supply a custom factory.
///
/// H is a hashing functor.
/// It transforms a T into a size_t, it's hash value:
/// size_t H( T const& ) const;
/// It must have a typedef called argument_type.
///
/// C is a comparison functor.
/// It returns true if two T's are equal:
/// bool C( T const&, T const& ) const;
///
/// F is a factory for an array of Ts.
///
/// This class is NOT thread-safe.  However, it has a lock and unlock method,
/// so you can single-thread it, if you want.  That's what HashSet does.
template <class T, class H, class C = std::equal_to<T>, class F=TFactory<T> >
class HopscotchHashSet : public SpinLockedData
{
public:
    typedef T value_type;
    typedef value_type const* const_pointer;
    typedef value_type const& const_reference;
    typedef unsigned size_type;
    typedef std::ptrdiff_t difference_type;
    typedef H hash_func_type;
    typedef C comp_func_type;
    typedef F factory_type;
    typedef typename H::argument_type const& key_type;
    friend class HashSet<T,H,C,F>;

    class NoRoomException : public std::exception
    {
    public:
        NoRoomException( char const* msg ) : mMsg(msg) {}
        char const* what() const throw() { return mMsg; }
    private:
        char const* mMsg;
    };

    // this is a const_iterator over the value_type entries
    class const_iterator
    : public std::iterator<std::bidirectional_iterator_tag,value_type const>,
      public IteratorBiDiBase<const_iterator,const_pointer,difference_type>
    {
        typedef IteratorBiDiBase<const_iterator,const_pointer,difference_type> Base;
    public:
        const_iterator() : Base(0), mpHHS(0) {}

        const_iterator( const_pointer pCur, HopscotchHashSet const* pHS )
        : Base(pCur-1), mpHHS(pHS)
        { fwd(1); }

        // compiler-supplied copying and destructor are OK

        const_reference operator*() const { return *Base::pos(); }
        const_pointer operator->() const { return Base::pos(); }

        void fwd( difference_type diff )
        { if ( diff < 0 ) bwd(-diff);
          else
            while ( diff-- )
              do { Base::fwd(1); }
              while ( mpHHS->isEmptyPosition(Base::pos()) ); }

        void bwd( difference_type diff )
        { if ( diff < 0 ) fwd(-diff);
          else
            while ( diff-- )
              do { Base::bwd(1); }
              while ( mpHHS->isEmptyPosition(Base::pos()) ); }

    private:
        HopscotchHashSet const* mpHHS;
    };

    explicit HopscotchHashSet( size_type cap,
                                    HCF<T,H,C,F> const& hcf = HCF<T,H,C,F>() )
    : mHCF(hcf), mCapacity(adjustCapacity(cap)), mSize(0),
      mBuckets(hcf.create(capacity())),
      mBktInfo(hcf.alloc(static_cast<BktStatus*>(nullptr)).allocate(capacity()))
    { memset(mBktInfo,0,capacity()); }

    HopscotchHashSet( HopscotchHashSet const& that )
    : mHCF(that.mHCF), mCapacity(that.capacity()), mSize(0),
      mBuckets(that.mHCF.create(capacity())),
      mBktInfo(that.mHCF.alloc(static_cast<BktStatus*>(nullptr)).allocate(capacity()))
    { memset(mBktInfo,0,capacity());
      *this = that; }

    ~HopscotchHashSet()
    { mHCF.destroy(mBuckets,capacity());
      mHCF.alloc(static_cast<BktStatus*>(nullptr)).deallocate(mBktInfo,mCapacity); }

    HopscotchHashSet& operator=( HopscotchHashSet const& that )
    { if ( this != &that )
      { clear();
        BktStatus const* start = that.mBktInfo;
        BktStatus const* end = start + that.capacity();
        for ( BktStatus const* itr(start); itr != end; ++itr )
          if ( itr->getStatus() == BktStatus::HEAD )
            add(that.mBuckets[itr-start]);
        for ( BktStatus const* itr(start); itr != end; ++itr )
          if ( itr->getStatus() == BktStatus::SQUATTER )
            add(that.mBuckets[itr-start]); }
      return *this; }

    size_type capacity() const { return mCapacity; }
    size_type size() const { return mSize; }

    const_iterator begin() const { return const_iterator(mBuckets,this); }
    const_iterator end() const
    { return const_iterator(mBuckets+capacity(),this); }

    /// Returns true if the value is in the set.
    bool contains( key_type val ) const { return lookup(val); }

    /// Returns pointer to val, or null pointer if val is not in set.
    const_pointer lookup( key_type val ) const
    { return lookup(val,mHCF.hash(val)); }

    /// Returns true if the value was added (otherwise, it was already present).
    bool add( key_type val ) throw(NoRoomException)
    { return add(val,mHCF.hash(val)); }

    /// Returns a reference to the value.  Inserts value, if not present.
    const_reference operator[]( key_type val ) throw(NoRoomException)
    { size_type idx = mHCF.hash(val) % capacity();
      const_pointer pBkt = find(val,idx);
      if ( pBkt ) return *pBkt; // EARLY RETURN!
      return (findInsertSlot(val,idx) = val); }

    /// Removes the value from the set.  Returns false if value not present.
    bool remove( key_type val )
    { return remove(val,mHCF.hash(val)); }

    /// Removes all entries for which the functor is true by copying all the
    /// retained values, and swapping.
    template <class Functor>
    void remove_if( Functor func )
    { HopscotchHashSet that(mCapacity,mHCF);
      for ( size_t idx = 0; idx != mCapacity; ++idx )
      {
        BktStatus* pInfo = mBktInfo+idx;
        if ( pInfo->getStatus() == BktStatus::HEAD )
        { const_pointer pBucket = mBuckets+idx;
          if ( !func(*pBucket) ) that.findInsertSlot(idx) = *pBucket;
          while ( pInfo->hasNext() )
          { pInfo = next(pInfo);
            pBucket = mBuckets+(pInfo-mBktInfo);
            if ( !func(*pBucket) ) that.findInsertSlot(idx) = *pBucket; } } }
      swap(*this,that); }

    /// Removes all values from the set.
    HopscotchHashSet& clear()
    { memset(mBktInfo,0,capacity()); mSize = 0; return *this; }

    bool isEmptyPosition( const_pointer pBkt ) const
    { size_type idx = pBkt - mBuckets;
      return idx < capacity() && mBktInfo[idx].getStatus()==BktStatus::EMPTY; }

    void writeBinary( BinaryWriter& writer ) const
    { writer.write(mSize);
      writer.write(mBktInfo,mBktInfo+mCapacity);
      writer.write(mBuckets,mBuckets+mCapacity); }

    void readBinary( BinaryReader& reader )
    { reader.read(&mSize);
      reader.read(mBktInfo,mBktInfo+mCapacity);
      reader.read(mBuckets,mBuckets+mCapacity); }

    static size_t externalSizeof() { return 0; }

    /// Swaps set contents.
    friend void swap( HopscotchHashSet& set1, HopscotchHashSet& set2 )
    { using std::swap;
      swap(set1.mCapacity,set2.mCapacity);
      swap(set1.mSize,set2.mSize);
      swap(set1.mBuckets,set2.mBuckets);
      swap(set1.mBktInfo,set2.mBktInfo);
      swap(set1.mHCF,set2.mHCF); }
      // note:  base class spinlock is not swapped, and that's on purpose

protected:
    // these protected methods are used by the friendly HashSet, which follows

    const_pointer lookup( key_type val, size_t hash ) const
    { return find(val,hash%capacity()); }

    template <class Comp>
    const_pointer lookup( key_type val, size_t hash, Comp const& comp ) const
    { // Check home slot.
      const_pointer pBkt = 0;
      BktStatus const* pInfo = mBktInfo + hash%capacity();
      if ( pInfo->getStatus() == BktStatus::HEAD )
      { pBkt = &mBuckets[pInfo - mBktInfo];
        if ( !comp(val,*pBkt) )
        { pBkt = 0;
          // Check the rest of the chain, if any.
          while ( pInfo->hasNext() )
          { pInfo = next(pInfo);
            const_reference bkt = mBuckets[pInfo - mBktInfo];
            if ( comp(val,bkt) ) {pBkt = &bkt; break; } } } }
      return pBkt; }

    bool add( key_type val, size_t hash ) throw(NoRoomException)
    { size_type idx = hash%capacity();
      if ( find(val,idx) ) return false;
      findInsertSlot(idx) = val; return true; }

    bool remove( key_type val, size_t hash )
    { // Find the head slot, and make sure it's actually a chain head. (If it's
      // empty or an overflow slot, there are no keys with the right hash.)
      BktStatus* pInfo = mBktInfo + hash%capacity();
      if ( pInfo->getStatus() != BktStatus::HEAD ) return false;// EARLY RETURN!
      BktStatus* pInfoPrev = 0;
      value_type* pBkt;
      // Find the right slot, where the value compares equal to the one sought.
      while ( true )
      { pBkt = &mBuckets[pInfo - mBktInfo];
        if ( mHCF.compare(val,*pBkt) ) break;
        if ( !pInfo->hasNext() ) return false; // EARLY RETURN!
        pInfoPrev = pInfo;
        pInfo = next(pInfo); }

      // At this point, pInfo and pBkt point to the right places for the value
      // to be deleted, and pInfoPrev is either the previous entry in the chain,
      // or null (when the value was found at the chain head).
      if ( pInfo->hasNext() ) copyAndKillEndOfChain(pInfo,pBkt);
      else // else at end of chain
      { if ( pInfoPrev ) pInfoPrev->setOffset(0);
        pInfo->setStatus(BktStatus::EMPTY); }
      mSize -= 1;
      return true; }

    const_reference insertK( key_type val, size_t hash ) throw(NoRoomException)
    { return (findInsertSlot(hash%capacity()) = val); }

    void insertV( value_type const& val, size_t hash ) throw(NoRoomException)
    { findInsertSlot(hash%capacity()) = val; }

    void insertV( value_type&& val, size_t hash ) throw(NoRoomException)
    { findInsertSlot(hash%capacity()) = std::move(val); }

private:
    BktStatus* next( BktStatus* pInfo )
    { pInfo = pInfo->next();
      if ( pInfo < mBktInfo ) pInfo += capacity();
      return pInfo; }

    BktStatus const* next( BktStatus const* pInfo ) const
    { pInfo = pInfo->next();
      if ( pInfo < mBktInfo ) pInfo += capacity();
      return pInfo; }

    size_type distance( BktStatus const* pInfo, BktStatus const* pInfo2 ) const
    { return pInfo2 < pInfo ? pInfo-pInfo2 : pInfo-pInfo2+capacity(); }

    // Walk chain to find value.
    const_pointer find( key_type val, size_type offset ) const
    { // Check home slot.
      const_pointer pBkt = 0;
      BktStatus const* pInfo = mBktInfo + offset;
      if ( pInfo->getStatus() == BktStatus::HEAD )
      { pBkt = &mBuckets[pInfo - mBktInfo];
        if ( !mHCF.compare(val,*pBkt) )
        { pBkt = 0;
          // Check the rest of the chain, if any.
          while ( pInfo->hasNext() )
          { pInfo = next(pInfo);
            const_reference bkt = mBuckets[pInfo - mBktInfo];
            if ( mHCF.compare(val,bkt) ) {pBkt = &bkt; break; } } } }
      return pBkt; }

    void copyAndKillEndOfChain( BktStatus* pInfo, value_type* pBkt )
    { Assert(pInfo->hasNext());
      BktStatus* pInfoPrev;
      do { pInfoPrev = pInfo; pInfo = next(pInfo); }
      while ( pInfo->hasNext() );
      *pBkt = std::move(mBuckets[pInfo-mBktInfo]);
      pInfoPrev->setOffset(0);
      pInfo->setStatus(BktStatus::EMPTY); }

    // Find a place for a value known not to be present.  Idx is the chain head.
    value_type& findInsertSlot( size_type idx )
      throw(NoRoomException)
    { if ( size() == capacity() )
        throw NoRoomException("capacity exceeded");
      BktStatus* pInfo = mBktInfo + idx;
      switch ( pInfo->getStatus() )
      {case BktStatus::SQUATTER: // move squatter, then use now-empty slot
         bump(pInfo);
         // no break statement -- allow flow-through to next case
       case BktStatus::EMPTY: // just use the empty slot
         pInfo->setStatus(BktStatus::HEAD);
         break;
       case BktStatus::HEAD: // extend chain
       { while ( pInfo->hasNext() ) pInfo = next(pInfo);
         BktStatus* pInfo2 = findEmpty(pInfo);
         pInfo2->setStatus(BktStatus::SQUATTER);
         pInfo->setOffset(distance(pInfo,pInfo2));
         pInfo = pInfo2;
         break; } }
      mSize += 1;
      return mBuckets[pInfo-mBktInfo]; }

    // move a SQUATTER key elsewhere
    void bump( BktStatus* pBump ) throw(NoRoomException)
    { AssertEq((int)pBump->getStatus(),(int)BktStatus::SQUATTER);

      // search for the entry that points to pBump
      BktStatus* pPrev = pBump;
      size_type off = 0;
      do
      { if ( ++pPrev >= mBktInfo+capacity() ) pPrev -= capacity(); }
      while ( ++off != pPrev->getOffset() );

      // loop for weird edge case where pEmpty gets picked too far from
      // its successor-to-be
      BktStatus* pEmpty;
      size_type distToEmpty;
      size_type distToSucc;
      while ( true ) // loop for weird edge case
      { pEmpty = findEmpty(pPrev);
        distToEmpty = distance(pPrev,pEmpty);
        distToSucc = pPrev->getOffset() + pBump->getOffset();
        if ( !pBump->hasNext() ||
             distToEmpty > pPrev->getOffset() ||
             distToSucc-distToEmpty <= BktStatus::maxOffset() ) break;
        // handle difficult case where pEmpty is too far from its successor
        copyAndKillEndOfChain(pBump,&mBuckets[pEmpty-mBktInfo]);
        pEmpty->setStatus(BktStatus::SQUATTER);
        // link pEmpty into chain between pPrev and pBump
        pEmpty->setOffset(pPrev->getOffset()-distToEmpty);
        pPrev->setOffset(distToEmpty);
        pPrev = pEmpty; }

      // move pBump's value to pEmpty
      move(pPrev,pBump,pEmpty,distToEmpty,distToSucc); }

    void move( BktStatus* pPrev, BktStatus* pBump, BktStatus* pEmpty,
               size_type distToEmpty, size_type distToSucc )
    { // move pBump's value to pEmpty
      mBuckets[pEmpty-mBktInfo] = std::move(mBuckets[pBump-mBktInfo]);
      pEmpty->setStatus(BktStatus::SQUATTER);

      // fix up chain, as necessary
      if ( pBump->hasNext() )
      { if ( distToSucc > distToEmpty )
          pEmpty->setOffset(distToSucc-distToEmpty);
        else
        { pPrev->setOffset(distToSucc); // snip pBump out of chain
          // walk down chain to the end, or until pEmpty is between pPrev
          // and its successor
          do { distToEmpty -= pPrev->getOffset(); pPrev = next(pPrev); }
          while ( pPrev->hasNext() && pPrev->getOffset() < distToEmpty );
          if ( pPrev->hasNext() )
            pEmpty->setOffset(pPrev->getOffset()-distToEmpty); } }
      pPrev->setOffset(distToEmpty);

      // pBump is now free
      pBump->setStatus(BktStatus::EMPTY);
      pBump->setOffset(0); }

    // find empty slot within range of pInfo, or create one by hopscotchingSet
    BktStatus* findEmpty( BktStatus* pInfo ) throw(NoRoomException)
    { AssertLt(mSize,capacity());
      BktStatus* pEmpty = pInfo;
      do { if ( --pEmpty < mBktInfo ) pEmpty += capacity(); }
      while ( pEmpty->getStatus() != BktStatus::EMPTY );
      while ( distance(pInfo,pEmpty) > BktStatus::maxOffset() )
          pEmpty = hopScotch(pEmpty);
      return pEmpty; }

    BktStatus* hopScotch( BktStatus* pEmpty ) throw (NoRoomException)
    { AssertEq((int)pEmpty->getStatus(),(int)BktStatus::EMPTY);
      BktStatus* pPrev = pEmpty + BktStatus::maxOffset();
      if ( pPrev >= mBktInfo + capacity() ) pPrev -= capacity();
      size_type distToEmpty = BktStatus::maxOffset();
      // for each entry that's in range of the free slot
      while ( pPrev != pEmpty )
      { // if pPrev's successor follows pEmpty (a move in the right direction)
        if ( pPrev->hasNext() && pPrev->getOffset() < distToEmpty )
        { BktStatus* pBump = next(pPrev);
          size_type distToSucc = pPrev->getOffset()+pBump->getOffset();
          // if the chain can be made whole after swapping pBump and pEmpty
          if ( !pBump->hasNext() || distToEmpty > pPrev->getOffset() ||
                  distToSucc-distToEmpty <= BktStatus::maxOffset() )
          { move(pPrev,pBump,pEmpty,distToEmpty,distToSucc);
            return pBump; } } // EARLY RETURN!
        distToEmpty -= 1;
        if ( --pPrev < mBktInfo ) pPrev += capacity(); }
      throw NoRoomException("hopscotching failed"); }

    static size_type adjustCapacity( size_type capacity )
    { if ( capacity < 2*BktStatus::maxOffset()+1 )
        capacity = 2*BktStatus::maxOffset()+1;
      capacity |= 1;
      while ( !capacity%3 || !capacity%5 || !capacity%7 || !capacity%11 )
        capacity += 2;
      return capacity; }

    HCF<T,H,C,F> mHCF;
    size_type mCapacity;
    size_type mSize;
    value_type* mBuckets;
    BktStatus* mBktInfo;
};

template <class T, class H, class C, class F>
struct Serializability< HopscotchHashSet<T,H,C,F> >
{ typedef SelfSerializable type; };

/// A gracefully-growable HashSet.
/// Splits fixed-size hopscotch hash sets as it grows.  This means that only a
/// fraction of the keys might need to be reorganized for any given call to
/// add() or operator[], which is smoother than reorganizing the whole
/// enchilada, as is typical in size-doubling schemes.  It also means that
/// memory use is in a few, large chunks, rather than requiring one giant
/// contiguous space.
/// Template args as for HopscotchHashSet.
///
/// Thread-safe for multiple writers.  Thread-safe for multiple readers.
/// NOT thread-safe for a mix of readers and writers.
template <class T, class H=std::hash<T>, class C=std::equal_to<T>, class F=TFactory<T> >
class HashSet : private SpinLockedData
{
public:
    typedef T value_type;
    typedef value_type const* const_pointer;
    typedef value_type const& const_reference;
    typedef size_t size_type;
    typedef std::ptrdiff_t difference_type;
    typedef H hash_func_type;
    typedef C comp_func_type;
    typedef F factory_type;
    typedef typename H::argument_type const& key_type;
    typedef HopscotchHashSet<T,H,C,F> HHS;
    typedef HHS*volatile* PPHHS;
    typedef typename HHS::NoRoomException NoRoomException;
    typedef typename HHS::const_iterator ICItr;

    // This is an iterator over the HopscotchHashSets.
    // Sorry to expose this bit of internal organization, but it seems simpler.
    // To iterate over entries, you'll need a nested for loop.
    class iterator
    : public std::iterator<std::bidirectional_iterator_tag,HHS>,
      public IteratorBiDiBase<iterator,PPHHS,difference_type>
    {
        typedef IteratorBiDiBase<iterator,PPHHS,difference_type> Base;
    public:
        iterator() : Base(0), mpHS(0) {}

        iterator( PPHHS pCur, HashSet* pHS )
        : Base(pCur-1), mpHS(pHS)
        { fwd(1); }

        // compiler-supplied copying and destructor are OK

        HHS& operator*() const { return **Base::pos(); }
        HHS* operator->() const { return *Base::pos(); }

        void fwd( difference_type diff )
        { if ( diff < 0 ) bwd(-diff);
          else
            while ( diff-- )
              do { Base::fwd(1); }
              while ( mpHS->isEmptyPosition(Base::pos()) ); }

        void bwd( difference_type diff )
        { if ( diff < 0 ) fwd(-diff);
          else
            while ( diff-- )
              do { Base::bwd(1); }
              while ( mpHS->isEmptyPosition(Base::pos()) ); }

    private:
        HashSet* mpHS;
    };

    // This is a const_iterator over the (const) HopscotchHashSets.
    // Sorry to expose this bit of internal organization, but it seems simpler.
    // To iterate over entries, you'll need a nested for loop.
    class const_iterator
    : public std::iterator<std::bidirectional_iterator_tag,HHS const>,
      public IteratorBiDiBase<const_iterator,PPHHS,difference_type>
    {
        typedef IteratorBiDiBase<const_iterator,PPHHS,difference_type> Base;
    public:
        const_iterator() : Base(0), mpHS(0) {}

        const_iterator( PPHHS pCur, HashSet const* pHS )
        : Base(pCur-1), mpHS(pHS)
        { fwd(1); }

        // compiler-supplied copying and destructor are OK

        HHS const& operator*() const { return **Base::pos(); }
        HHS const* operator->() const { return *Base::pos(); }

        void fwd( difference_type diff )
        { if ( diff < 0 ) bwd(-diff);
          else
            while ( diff-- )
              do { Base::fwd(1); }
              while ( mpHS->isEmptyPosition(Base::pos()) ); }

        void bwd( difference_type diff )
        { if ( diff < 0 ) fwd(-diff);
          else
            while ( diff-- )
              do { Base::bwd(1); }
              while ( mpHS->isEmptyPosition(Base::pos()) ); }

    private:
        HashSet const* mpHS;
    };

    explicit HashSet( size_t cap,
                      hash_func_type const& hasher = hash_func_type(),
                      comp_func_type const& comper = comp_func_type(),
                      factory_type const& factory = factory_type(),
                      double maxLoadFactor=.75 )
    : mHCF(hasher,comper,factory)
    { init(cap,maxLoadFactor); }

    HashSet( HashSet const& that )
    : mHCF(that.mHCF)
    { init(that.size());
      const_iterator end(that.end());
      for ( const_iterator itr(that.begin()); itr != end; ++itr )
        add(itr->begin(),itr->end()); }

    ~HashSet() { destroy(); }

    HashSet& operator=( HashSet const& that )
    { if ( this != &that )
      { clear(); const_iterator end(that.end());
        for ( const_iterator itr(that.begin()); itr != end; ++itr )
          add(itr->begin(),itr->end()); }
      return *this; }

    size_type size() const
    { size_t totSize = 0;
      PPHHS end(mppHHS+mCapacity);
      for ( PPHHS itr(mppHHS); itr != end; ++itr )
        if ( *itr ) totSize += (*itr)->size();
      return totSize; }

    factory_type const& getFactory() const { return mHCF; }
    hash_func_type const& getHasher() const { return mHCF; }
    comp_func_type const& getComparator() const { return mHCF; }

    const_iterator begin() const { return const_iterator(mppHHS,this); }
    const_iterator end() const { return const_iterator(mppHHS+mCapacity,this); }
    const_iterator cbegin() { return const_iterator(mppHHS,this); }
    const_iterator cend() { return const_iterator(mppHHS+mCapacity,this); }
    iterator begin() { return iterator(mppHHS,this); }
    iterator end() { return iterator(mppHHS+mCapacity,this); }

    /// Returns true if the value is in the set.
    /// Not safe to call when there are writers lurking about.  Fine in a
    /// readers-only context.  Sorry about the ridiculous rules for using the
    /// API for this class.
    bool contains( key_type val ) const { return lookup(val); }

    /// Returns pointer to val, or null pointer if val is not in set.
    /// Not safe to call when there are writers lurking about.  Fine in a
    /// readers-only context.  Sorry about the ridiculous rules for using the
    /// API for this class.
    const_pointer lookup( key_type val ) const
    { size_t hash = mHCF.hash(val);
      return findHHSC(hash)->lookup(val,hash); }

    template <class Comp>
    const_pointer lookup( size_t hash, key_type val, Comp const& comp ) const
    { return findHHSC(hash)->lookup(val,hash,comp); }

    /// Returns true if the value was added (otherwise, it was already present).
    bool add( key_type val )
    { size_t hash = mHCF.hash(val);
      HHS* pHHS = findHHS(hash);
      if ( pHHS->lookup(val,hash)  ) { pHHS->unlock(); return false; }
      insert(val,hash,pHHS); return true; }

    template <class Itr>
    void add( Itr itr, Itr end )
    { while ( itr != end ) add(*itr); }

    const_pointer add( size_t hash, key_type val )
    { HHS* pHHS = findHHS(hash);
      const_pointer ppp = pHHS->lookup(val,hash);
      if ( ppp ) { pHHS->unlock(); return ppp; } // EARLY RETURN!
      return &insert(val,hash,pHHS); }

    /// Applies functor to entry.  Inserts value, if not present.  Threadsafe.
    template <class Func>
    void apply( key_type val, Func func )
    { apply(mHCF.hash(val),val,func); }

    /// Applies functor to entry.  Inserts value, if not present.  Threadsafe.
    template <class Func>
    void apply( size_t hash, key_type val, Func func )
    { HHS* pHHS = findHHS(hash);
      const_pointer pEnt = pHHS->lookup(val,hash);
      if ( !pEnt ) pEnt = &insertLocked(val,hash,pHHS);
      func(*pEnt); pHHS->unlock(); }

    /// Returns a reference to the value.  Inserts value, if not present.
    const_reference operator[]( key_type val )
    { size_t hash = mHCF.hash(val);
      HHS* pHHS = findHHS(hash);
      const_pointer ppp = pHHS->lookup(val,hash);
      if ( ppp ) { pHHS->unlock(); return *ppp; } // EARLY RETURN!
      return insert(val,hash,pHHS); }

    /// Specialized inserter:  Inserts value_type rather than key,
    /// does not check for uniqueness.  This is dangerous, and would typically
    /// be used only when copying values known to comprise a set into a
    /// hashtable -- perhaps in a reduce function for the MapReduceEngine.
    void insertUniqueValue( value_type const& val )
    { size_t hash = mHCF.hash(val);
      HHS* pHHS = findHHS(hash);
      while ( true )
      { try  { pHHS->insertV(val,hash); pHHS->unlock(); break; }
        catch ( NoRoomException const& ) { pHHS = split(hash); } } }

    /// Specialized inserter:  No locking, inserts value_type rather than key,
    /// does not check for uniqueness.  This is dangerous, and would typically
    /// be used only when copying values known to comprise a set into a
    /// hashtable from a single thread -- perhaps when you're reading a cached
    /// binary file.
    void insertUniqueValueNoLocking( value_type const& val )
    { size_t hash = mHCF.hash(val);
      HHS* pHHS = findHHSC(hash);
      while ( true )
      { try  { pHHS->insertV(val,hash); break; }
        catch ( NoRoomException const& ) { pHHS = split(hash); } } }

    /// Removes the value from the set.  Returns false if value not present.
    bool remove( key_type val )
    { size_t hash = mHCF.hash(val);
      HHS* pHHS = findHHS(hash);
      bool result = pHHS->remove(val,hash);
      pHHS->unlock();
      return result; }

    /// Removes the value from the set.  Returns false if value not present.
    /// Not thread-safe for obvious reasons.
    bool removeNoLocking( key_type val )
    { size_t hash = mHCF.hash(val);
      HHS* pHHS = findHHSC(hash);
      return pHHS->remove(val,hash); }

    /// Removes all entries for which the functor returns true.
    /// This effectively rebuilds the entire table in place, and isn't a good
    /// idea if you're removing a small fraction of the entries.  (Iterate,
    /// and call remove instead.)  Not thread safe.
    template <class Functor>
    void remove_if( Functor const& func )
    { for ( PPHHS itr(mppHHS), end(mppHHS+mCapacity); itr != end; ++itr )
        if ( *itr ) (*itr)->remove_if(func); }

    /// Delete all values.  NB: No locking!  You can't call clear when there
    /// are simultaneous writers.
    HashSet& clear()
    { PPHHS end = mppHHS + mCapacity;
      for ( PPHHS itr(mppHHS); itr != end; ++itr )
        if ( *itr ) (*itr)->clear();
      return *this; }

    bool isEmptyPosition( PPHHS ppHHS ) const
    { size_type idx = ppHHS - mppHHS;
      return idx < mCapacity && !*ppHHS; }

    void writeBinary( BinaryWriter& writer ) const
    { size_type cap = mCapacity;
      writer.write(cap);
      writer.write(mInnerCapacity);
      PPHHS end = mppHHS + mCapacity;
      for ( PPHHS itr = mppHHS; itr != end; ++itr )
      { if ( !*itr ) writer.write(false);
        else { writer.write(true); writer.write(**itr); } } }

    void readBinary( BinaryReader& reader )
    { destroy();
      size_type cap; reader.read(&cap);
      ForceAssert(cap && !(cap & (cap-1)));
      mCapacity = cap;
      reader.read(&mInnerCapacity);
      mppHHS = allocArray(mCapacity);
      memset((void*)mppHHS.load(),0,mCapacity*sizeof(HHS*));
      PPHHS end = mppHHS + mCapacity;
      for ( PPHHS itr = mppHHS; itr != end; ++itr )
      { bool populated; reader.read(&populated);
        if ( populated )
        { *itr = createHHS(); reader.read(*itr); } } }

    static size_t externalSizeof() { return 0; }

    friend bool operator==( HashSet const& set1, HashSet const& set2 )
    { bool result = set1.size() == set2.size();
      for ( const_iterator oItr(set1.begin()), oEnd(set1.end());
            result && oItr != oEnd; ++oItr )
        for ( ICItr iItr(oItr->begin()), iEnd(oItr->end());
              result && iItr != iEnd; ++iItr )
        { const_pointer pEnt = set2.lookup(*iItr);
          result = pEnt && *pEnt == *iItr; }
      return result; }

    friend bool operator!=( HashSet const& set1, HashSet const& set2 )
    { return !(set1 == set2); }

    /// returns number of misassignments
    size_t validateBinAssignments() const
    { size_t result = 0;
      for ( PPHHS oitr=mppHHS,oend=mppHHS+mCapacity; oitr != oend; ++oitr )
      { if ( !*oitr ) continue;
        for ( ICItr itr=oitr[0]->begin(),end=oitr[0]->end(); itr != end; ++itr )
        { if ( findHHSC(mHCF.hash(*itr)) != *oitr ) result += 1; } }
      return result; }

    template <class Proc>
    void parallelForEachHHS( Proc proc,
                             size_t nThreads = getConfiguredNumThreads() ) const
    {
        PPHHS ppHHS = mppHHS;
        #pragma omp parallel
        {   Proc p(proc);
            #pragma omp for
            for (size_type idx = 0; idx < mCapacity; idx++) {
                HHS const *pHHS = ppHHS[idx];
                if (pHHS) p(*pHHS);
            }
        }
    }

private:
    HHS* createHHS()
    { HHS* pHHS = mHCF.alloc(static_cast<HHS*>(nullptr)).allocate(1);
      new (pHHS) HHS(mInnerCapacity,mHCF);
      return pHHS; }

    PPHHS allocArray( size_t nnn )
    { return (PPHHS)mHCF.alloc(static_cast<HHS**>(nullptr)).allocate(nnn); }

    void deallocArray( PPHHS ppHHS, size_t nnn )
    { mHCF.alloc(static_cast<HHS**>(nullptr)).deallocate((HHS**)ppHHS,nnn); }

    void init( size_t cap, double maxLoadFactor )
    { int capCeilLg2 = PowerOf2::ceilLg2(cap/maxLoadFactor);
      int innerCapLg2 = std::max(10,(capCeilLg2+1)/2);
      int outerCapLg2 = std::max(7,capCeilLg2-innerCapLg2);
      mCapacity = 1ul << outerCapLg2;
      mppHHS = allocArray(mCapacity);
      PPHHS ppp = mppHHS + mCapacity;
      mInnerCapacity = PowerOf2::getNearbyPrime(innerCapLg2);
      size_t allocCap = mCapacity*mInnerCapacity;
//if(cap>1000000)
//std::cout << "HashSet requested size=" << cap << " allocated size="
//            << allocCap << " load factor=" << 1.*cap/allocCap << std::endl;
      while ( ppp != mppHHS ) *--ppp = createHHS();
      mSplitCount = 0; }

    // no locking:  therefore only useful when there are not multiple writers
    // that might cause table reorganizations.
    HHS* findHHSC( size_t hash ) const
    { size_t mask = mCapacity - 1;
      hash ^= hash >> 32;
      HHS* result;
      PPHHS ppHHS = mppHHS;
      while ( !(result = ppHHS[hash&mask]) ) mask >>= 1;
      return result; }

    // return with HHS locked
    HHS* findHHS( size_t hash )
    { hash ^= hash >> 32;
      HHS* pHHS;
      while ( true )
      { unsigned splitCount = mSplitCount;
        size_t mask = mCapacity - 1;
        PPHHS ppHHS = mppHHS;
        while ( !(pHHS = ppHHS[hash & mask]) ) mask >>= 1;
        pHHS->lock();
        if ( splitCount == mSplitCount ) break;
        pHHS->unlock(); }
      return pHHS; }

    const_reference insert( key_type val, size_t hash, HHS* pHHS )
    { while ( true )
      { try
        { const_reference result = pHHS->insertK(val,hash);
          pHHS->unlock();
          return result; }
        catch ( NoRoomException const& )
        { pHHS = split(hash); } } }

    const_reference insertLocked( key_type val, size_t hash, HHS*& pHHS )
    { while ( true )
      { try
        { return pHHS->insertK(val,hash); }
        catch ( NoRoomException const& )
        { pHHS = split(hash); } } }

    HHS* split( size_t hash )
    { HHS* pHi = createHHS();
      pHi->lock();

      lock();
      size_t capacity = mCapacity;
      size_t mask = capacity - 1;
      hash ^= hash >> 32;
      while ( !mppHHS[hash&mask] ) mask >>= 1;
      size_t idxLo = hash&mask++;
      while ( !mppHHS[idxLo|(mask>>1)] ) mask >>= 1;
      size_t idxHi = idxLo | mask;
      if ( idxHi >= capacity )
      { PPHHS ppHHS = allocArray(capacity<<1);
        memcpy((void*)ppHHS,(void*)mppHHS.load(),capacity*sizeof(HHS*));
        memset((void*)(ppHHS+capacity),0,capacity*sizeof(HHS*));
        mOldppHHSs.push_front((PPHHS)mppHHS);
        mppHHS = ppHHS; mCapacity = 2*capacity; }
      mppHHS[idxHi] = pHi;
      ++mSplitCount;
      unlock();

      HHS* pLo = mppHHS[idxLo];
      HHS tmp(mInnerCapacity,mHCF);
      for ( ICItr itr(pLo->begin()), end(pLo->end()); itr != end; ++itr )
      { value_type& val = const_cast<value_type&>(*itr);
        size_t hash2 = mHCF.hash(val);
        (((hash2^(hash2>>32))&mask)?pHi:&tmp)->insertV(std::move(val),hash2); }
      if ( hash&mask ) { swap(*pLo,tmp); pLo->unlock(); pLo = pHi; }
      else { pHi->unlock(); swap(*pLo,tmp); }

      return pLo; }

    void destroy()
    { PPHHS end = mppHHS+mCapacity;
      size_t nHHS = 0;
      for ( PPHHS itr(mppHHS); itr != end; ++itr )
      { HHS* pHHS = *itr;
        if ( pHHS )
        { pHHS->~HHS();
          mHCF.alloc(pHHS).deallocate(pHHS,1);
          nHHS += 1; } }
      deallocArray(mppHHS,mCapacity);
      size_type capacity = mCapacity;
      for ( auto itr=mOldppHHSs.begin(), end=mOldppHHSs.end(); itr!=end; ++itr )
        deallocArray(*itr,capacity/=2);
      mOldppHHSs.clear();
      if ( 1.*nHHS/(nHHS-mSplitCount) > 1.3 )
        std::cout << "Warning: HashSet initial size too small." << std::endl;
    }

    std::atomic<PPHHS> mppHHS;        // length == mCapacity
    std::atomic<size_type> mCapacity; // number of HHS's, not max values:
                                      //   always a power of 2
    std::atomic<unsigned> mSplitCount;// counter of the number of splits
    unsigned mInnerCapacity;          // prime number just < than a power of 2
    std::list<PPHHS> mOldppHHSs;
    HCF<T,H,C,F> mHCF;
};

template <class T, class H, class C, class F>
struct Serializability< HashSet<T,H,C,F> >
{ typedef SelfSerializable type; };

#endif /* FEUDAL_HASHSET_H */


text:
.ult_pricing_table_wrap {
    min-width: 100%
}
.wpb_column .wpb_wrapper .ult_pricing_table_wrap,
.wpb_column .wpb_wrapper .ult_pricing_table_wrap:last-child {
    display: block;
    margin-bottom: 35px;
    float: left
}
.ult_pricing_table,
.ult_pricing_heading,
.ult_price_body_block,
.ult_price_features,
.ult_price_link,
.ult_price_description_block {
    margin: 0;
    padding: 0;
    width: 100%;
    float: left;
    display: block;
    position: relative
}
.ult_pricing_table {
    list-style-type: none;
    font-size: 13px;
    text-align: center;
    -moz-transition: all 300ms linear;
    -webkit-transition: all 300ms linear;
    -o-transition: all 300ms linear;
    -ms-transition: all 300ms linear;
    transition: all 300ms linear;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -o-box-sizing: border-box;
    -ms-box-sizing: border-box;
    box-sizing: border-box
}
.ult_pricing_table .ult_pricing_heading {
    padding: 20px 0
}
.ult_pricing_table .ult_pricing_heading h3 {
    padding: 0;
    margin: 0;
    font-size: 16px;
    font-weight: bold;
    line-height: 1.4em;
    color: inherit
}
.ult_pricing_table .ult_pricing_heading h5 {
    padding: 0;
    margin: 4px 20px 15px;
    font-size: 12px;
    font-weight: normal;
    color: inherit;
}
.ult_pricing_table .ult_price_body,
.wpb_column>.wpb_wrapper>.ult_pricing_table_wrap .ult_pricing_table .ult_price_body {
    display: table;
    margin: 15px auto;
}
.ult_price_body .ult_price {
    vertical-align: middle;
    display: table-cell;
    word-break: break-all
}
.ult_price_body .ult_price .ult_price_figure {
    display: block;
    font-size: 1em;
    line-height: 1.3em;
    font-weight: normal
}
.ult_price_body .ult_price .ult_price_term {
    font-size: 11px;
    font-weight: normal;
    display: block
}
.ult_pricing_table .ult_price_features {
    padding: 15px 15px 0px 15px;
    margin: 0
}
.ult_pricing_table .ult_price_features ul {
    color: inherit;
    list-style-type: none;
    padding: 0;
    margin: 0 0 20px
}
.ult_pricing_table .ult_price_features ul li {
    color: inherit;
    list-style-type: none;
    padding: 5px 0;
    margin: 0;
    line-height: 1.5em;
    text-decoration: none
}
.ult_pricing_table a {
    text-decoration: none !important;
    cursor: pointer
}
.ult_pricing_table .ult_price_description_block .ult_price_description {
    list-style-type: none;
    padding: 15px;
    margin: 0;
    line-height: 1.5em
}
.ult_pricing_table .ult_price_link {
    padding: 0 0 15px 0;
}
.ult_pricing_table .ult_price_link .ult_price_action_button {
    display: inline-block;
    text-decoration: none;
    font-weight: normal;
    line-height: 1em;
    padding: 9px 20px
}
.ult_pricing_table_wrap .ult_price_features img {
    width: 100%;
    max-width: 100%;
    display: block
}
.ult_clr {
    clear: both
}
.ult_featured .ult_pricing_table {
    position: relative;
    z-index: 9;
    -webkit-transform: scale(1.03);
    -moz-transform: scale(1.03);
    -o-transform: scale(1.03);
    -ms-transform: scale(1.03);
    transform: scale(1.03)
}
.ult_pricing_table:hover {
    box-shadow: 0 0 7px rgba(167, 167, 167, 0.5)
}
.ult_info_table.ult_design_1 .ult_pricing_table .ult_price_body {
    border: 0;
    width: auto;
    height: auto
}
.ult_info_table .ult_pricing_table .ult_price_body .aio-icon.none {
    display: block;
    margin: 0 auto
}
.ult_design_1 .ult_pricing_table {
    background: #444;
    background: -webkit-linear-gradient(#666, #333);
    background: -moz-linear-gradient(#666, #333);
    background: -o-linear-gradient(#666, #333);
    background: linear-gradient(#666, #333);
    color: #fff
}
.ult_design_1 .ult_pricing_table a {
    color: inherit
}
.ult_design_1 .ult_pricing_table .ult_price_body {
    font-size: 16px;
    width: 6em;
    height: 6em;
    padding: 0;
    line-height: 1em;
    border: 2px solid;
    border-radius: 500%
}
.ult_design_1 .ult_pricing_table .ult_price_link {
    background: #333
}
.ult_design_1 .ult_pricing_table .ult_price_link .ult_price_action_button {
    color: #fff;
    background: #000;
    border-radius: 15px;
    background: #444;
    background: -webkit-linear-gradient(#666, #333);
    background: -moz-linear-gradient(#666, #333);
    background: -o-linear-gradient(#666, #333);
    background: linear-gradient(#666, #333)
}
.ult_design_1.ult-cs-black .ult_pricing_table,
.ult_design_1.ult-cs-black .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #333;
    background: -webkit-linear-gradient(#666, #333);
    background: -moz-linear-gradient(#666, #333);
    background: -o-linear-gradient(#666, #333);
    background: linear-gradient(#666, #333)
}
.ult_design_1.ult-cs-red .ult_pricing_table,
.ult_design_1.ult-cs-red .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #df4130;
    background: -webkit-linear-gradient(#f04735, #df4130);
    background: -moz-linear-gradient(#f04735, #df4130);
    background: -o-linear-gradient(#f04735, #df4130);
    background: linear-gradient(#f04735, #df4130)
}
.ult_design_1.ult-cs-blue .ult_pricing_table,
.ult_design_1.ult-cs-blue .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #2867b6;
    background: -webkit-linear-gradient(#3274c7, #2867b6);
    background: -moz-linear-gradient(#3274c7, #2867b6);
    background: -o-linear-gradient(#3274c7, #2867b6);
    background: linear-gradient(#3274c7, #2867b6)
}
.ult_design_1.ult-cs-yellow .ult_pricing_table,
.ult_design_1.ult-cs-yellow .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #f9b84a;
    background: -webkit-linear-gradient(#f1c40f, #f1a90f);
    background: -moz-linear-gradient(#f1c40f, #f1a90f);
    background: -o-linear-gradient(#f1c40f, #f1a90f);
    background: linear-gradient(#f1c40f, #f1a90f)
}
.ult_design_1.ult-cs-green .ult_pricing_table,
.ult_design_1.ult-cs-green .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #17924b;
    background: -webkit-linear-gradient(#24bb64, #17924b);
    background: -moz-linear-gradient(#24bb64, #17924b);
    background: -o-linear-gradient(#24bb64, #17924b);
    background: linear-gradient(#24bb64, #17924b)
}
.ult_design_1.ult-cs-gray .ult_pricing_table,
.ult_design_1.ult-cs-gray .ult_pricing_table .ult_price_link .ult_price_action_button {
    color: #5d5d5d;
    background: #d9dee0;
    background: -webkit-linear-gradient(#e3e4e6, #d9dee0);
    background: -moz-linear-gradient(#e3e4e6, #d9dee0);
    background: -o-linear-gradient(#e3e4e6, #d9dee0);
    background: linear-gradient(#e3e4e6, #d9dee0)
}
.ult_design_2 .ult_pricing_table {
    background: linear-gradient(#FFF, #f0f0f0);
    color: #6f6f6f
}
.ult_design_2 .ult_pricing_table a {
    color: inherit
}
.ult_design_2 .ult_pricing_table .ult_pricing_heading,
.ult_design_2 .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #0f9000;
    background: -webkit-linear-gradient(#0f9000, #076800);
    background: -moz-linear-gradient(#0f9000, #076800);
    background: -o-linear-gradient(#0f9000, #076800);
    background: linear-gradient(#0f9000, #076800);
    color: #fff
}
.ult_design_2 .ult_pricing_table .ult_pricing_heading h5 {
    padding: 0;
    margin: 0 20px;
    font-size: 12px
}
.ult_design_2 .ult_price_body_block {
    background: #fbfbfb;
    border-bottom: 4px double #dcdcdc;
    color: #6f6f6f
}
.ult_design_2 .ult_pricing_table .ult_price_body {
    font-size: 48px
}
.ult_design_2 .ult_pricing_table .ult_price_features ul li {
    border-bottom: 1px dashed #999;
    line-height: 2em;
    margin-left: 30px;
    margin-right: 30px
}
.ult_design_2 .ult_pricing_table .ult_price_features ul li:last-child {
    border-bottom: 0
}
.ult_design_2 .ult_pricing_table .ult_price_link {
    padding: 0
}
.ult_design_2 .ult_pricing_table .ult_price_link .ult_price_action_button {
    color: #fff;
    background: #000;
    border-radius: 3px;
    padding: 7px;
    background: #0f9000;
    background: -webkit-linear-gradient(#0f9000, #076800);
    background: -moz-linear-gradient(#0f9000, #076800);
    background: -o-linear-gradient(#0f9000, #076800);
    background: linear-gradient(#0f9000, #076800);
    position: absolute;
    right: -8px;
    bottom: -12px
}
.ult_design_2 .ult_pricing_table .ult_price_link .ult_price_action_button:after {
    content: "";
    display: block;
    position: absolute;
    width: 0;
    height: 0;
    bottom: -6px;
    right: 0;
    border-bottom: 8px solid rgba(0, 0, 0, 0);
    border-left: 8px solid #1a1a1a
}
.ult_design_2.ult-cs-black .ult_pricing_table .ult_pricing_heading,
.ult_design_2.ult-cs-black .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #333;
    background: -webkit-linear-gradient(#666, #333);
    background: -moz-linear-gradient(#666, #333);
    background: -o-linear-gradient(#666, #333);
    background: linear-gradient(#666, #333)
}
.ult_design_2.ult-cs-black .ult_pricing_table .ult_price_link .ult_price_action_button:after {
    border-left: 8px solid #1a1818
}
.ult_design_2.ult-cs-red .ult_pricing_table .ult_pricing_heading,
.ult_design_2.ult-cs-red .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #df4130;
    background: -webkit-linear-gradient(#f04735, #df4130);
    background: -moz-linear-gradient(#f04735, #df4130);
    background: -o-linear-gradient(#f04735, #df4130);
    background: linear-gradient(#f04735, #df4130)
}
.ult_design_2.ult-cs-red .ult_pricing_table .ult_price_link .ult_price_action_button:after {
    border-left: 8px solid #ac3900
}
.ult_design_2.ult-cs-blue .ult_pricing_table .ult_pricing_heading,
.ult_design_2.ult-cs-blue .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #2867b6;
    background: -webkit-linear-gradient(#3274c7, #2867b6);
    background: -moz-linear-gradient(#3274c7, #2867b6);
    background: -o-linear-gradient(#3274c7, #2867b6);
    background: linear-gradient(#3274c7, #2867b6)
}
.ult_design_2.ult-cs-blue .ult_pricing_table .ult_price_link .ult_price_action_button:after {
    border-left: 8px solid #0555ba
}
.ult_design_2.ult-cs-yellow .ult_pricing_table .ult_pricing_heading,
.ult_design_2.ult-cs-yellow .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #f9b84a;
    background: -webkit-linear-gradient(#f1c40f, #f1a90f);
    background: -moz-linear-gradient(#f1c40f, #f1a90f);
    background: -o-linear-gradient(#f1c40f, #f1a90f);
    background: linear-gradient(#f1c40f, #f1a90f)
}
.ult_design_2.ult-cs-yellow .ult_pricing_table .ult_price_link .ult_price_action_button:after {
    border-left: 8px solid #ce5e0b
}
.ult_design_2.ult-cs-green .ult_pricing_table .ult_pricing_heading,
.ult_design_2.ult-cs-green .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #17924b;
    background: -webkit-linear-gradient(#24bb64, #17924b);
    background: -moz-linear-gradient(#24bb64, #17924b);
    background: -o-linear-gradient(#24bb64, #17924b);
    background: linear-gradient(#24bb64, #17924b)
}
.ult_design_2.ult-cs-green .ult_pricing_table .ult_price_link .ult_price_action_button:after {
    border-left: 8px solid #037433
}
.ult_design_2.ult-cs-gray .ult_pricing_table .ult_pricing_heading,
.ult_design_2.ult-cs-gray .ult_pricing_table .ult_price_link .ult_price_action_button {
    color: #5d5d5d;
    background: #d9dee0;
    background: -webkit-linear-gradient(#e3e4e6, #d9dee0);
    background: -moz-linear-gradient(#e3e4e6, #d9dee0);
    background: -o-linear-gradient(#e3e4e6, #d9dee0);
    background: linear-gradient(#e3e4e6, #d9dee0)
}
.ult_design_2.ult-cs-gray .ult_pricing_table .ult_price_link .ult_price_action_button:after {
    border-left: 8px solid #bdbdbd
}
.ult_design_3 .ult_pricing_table {
    background: #262626;
    background: -webkit-linear-gradient(#262626, #000);
    background: -moz-linear-gradient(#262626, #000);
    background: -o-linear-gradient(#262626, #000);
    background: linear-gradient(#262626, #000);
    color: #FFF
}
.ult_design_3 .ult_pricing_table a {
    color: inherit
}
.ult_design_3 .ult_price_body_block {
    background: #353535
}
.ult_design_3 .ult_pricing_table .ult_price_body,
.wpb_column>.wpb_wrapper>.ult_pricing_table_wrap.ult_design_3 .ult_pricing_table .ult_price_body {
    margin: 25px auto;
    font-size: 40px
}
.ult_design_3 .ult_pricing_table .ult_price_link .ult_price_action_button {
    color: #fff;
    background: #000;
    border-radius: 3px;
    padding: 10px;
    background: #666;
    background: -webkit-linear-gradient(#666, #333);
    background: -moz-linear-gradient(#666, #333);
    background: -o-linear-gradient(#666, #333);
    background: linear-gradient(#666, #333)
}
.ult_design_3.ult-cs-black .ult_pricing_table {
    background: #333;
    background: -webkit-linear-gradient(#666, #333);
    background: -moz-linear-gradient(#666, #333);
    background: -o-linear-gradient(#666, #333);
    background: linear-gradient(#666, #333)
}
.ult_design_3.ult-cs-red .ult_pricing_table {
    background: #df4130;
    background: -webkit-linear-gradient(#f04735, #df4130);
    background: -moz-linear-gradient(#f04735, #df4130);
    background: -o-linear-gradient(#f04735, #df4130);
    background: linear-gradient(#f04735, #df4130)
}
.ult_design_3.ult-cs-blue .ult_pricing_table {
    background: #2867b6;
    background: -webkit-linear-gradient(#3274c7, #2867b6);
    background: -moz-linear-gradient(#3274c7, #2867b6);
    background: -o-linear-gradient(#3274c7, #2867b6);
    background: linear-gradient(#3274c7, #2867b6)
}
.ult_design_3.ult-cs-yellow .ult_pricing_table {
    background: #f9b84a;
    background: -webkit-linear-gradient(#f1c40f, #f1a90f);
    background: -moz-linear-gradient(#f1c40f, #f1a90f);
    background: -o-linear-gradient(#f1c40f, #f1a90f);
    background: linear-gradient(#f1c40f, #f1a90f)
}
.ult_design_3.ult-cs-green .ult_pricing_table {
    background: #17924b;
    background: -webkit-linear-gradient(#24bb64, #17924b);
    background: -moz-linear-gradient(#24bb64, #17924b);
    background: -o-linear-gradient(#24bb64, #17924b);
    background: linear-gradient(#24bb64, #17924b)
}
.ult_design_3.ult-cs-gray .ult_pricing_table {
    color: #5d5d5d;
    background: #d9dee0;
    background: -webkit-linear-gradient(#e3e4e6, #d9dee0);
    background: -moz-linear-gradient(#e3e4e6, #d9dee0);
    background: -o-linear-gradient(#e3e4e6, #d9dee0);
    background: linear-gradient(#e3e4e6, #d9dee0)
}
.ult_design_3.ult-cs-gray .ult_price_body_block {
    color: #FFF
}
.ult_design_4 .ult_pricing_table {
    background: #f9f9f9;
    color: #777;
    border-top: 5px solid #b9ce06;
    border-bottom: 5px solid #DDD
}
.ult_design_4 .ult_pricing_table a {
    color: inherit
}
.ult_design_4 .ult_pricing_table .ult_price_body_block {
    top: -3px;
    border-bottom: 2px solid #e5e5e5
}
.ult_design_4 .ult_pricing_table .ult_price_body {
    font-size: 48px
}
.ult_design_4 .ult_pricing_table .ult_pricing_heading+.ult_price_body_block .ult_price_body,
.wpb_column>.wpb_wrapper>.ult_pricing_table_wrap.ult_design_4 .ult_pricing_table .ult_pricing_heading+.ult_price_body_block .ult_price_body {
    margin: -5px auto 15px
}
.ult_design_4 .ult_pricing_table .ult_price_features ul li {
    border-bottom: 1px solid #ededed;
    line-height: 2em;
    margin-left: 30px;
    margin-right: 30px
}
.ult_design_4 .ult_pricing_table .ult_price_link .ult_price_action_button {
    color: #fff;
    background: #b9ce06;
    border-radius: 3px;
    padding: 10px
}
.ult_design_4.ult-cs-black .ult_pricing_table {
    border-top: 5px solid #333
}
.ult_design_4.ult-cs-black .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #333
}
.ult_design_4.ult-cs-red .ult_pricing_table {
    border-top: 5px solid #df4130
}
.ult_design_4.ult-cs-red .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #df4130
}
.ult_design_4.ult-cs-blue .ult_pricing_table {
    border-top: 5px solid #2867b6
}
.ult_design_4.ult-cs-blue .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #2867b6
}
.ult_design_4.ult-cs-yellow .ult_pricing_table {
    border-top: 5px solid #f1a90f
}
.ult_design_4.ult-cs-yellow .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #f1a90f
}
.ult_design_4.ult-cs-green .ult_pricing_table {
    border-top: 5px solid #17924b
}
.ult_design_4.ult-cs-green .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #17924b
}
.ult_design_4.ult-cs-gray .ult_pricing_table {
    border-top: 5px solid #d9dee0
}
.ult_design_4.ult-cs-gray .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #d9dee0;
    color: #5d5d5d
}
.ult_design_5 .ult_pricing_table {
    background: #f7f7f7;
    color: #777;
    border-bottom: 5px solid #DDD
}
.ult_design_5 .ult_pricing_table a {
    color: inherit
}
.ult_design_5 .ult_pricing_table .ult_pricing_heading,
.ult_design_5 .ult_pricing_table .ult_price_body_block {
    background: #fac635;
    color: #fff
}
.ult_design_5 .ult_pricing_table .ult_price_body_block {
    top: -3px
}
.ult_design_5 .ult_pricing_table .ult_price_body {
    font-size: 48px
}
.ult_design_5 .ult_pricing_table .ult_pricing_heading+.ult_price_body_block .ult_price_body,
.wpb_column>.wpb_wrapper>.ult_pricing_table_wrap.ult_design_5 .ult_pricing_table .ult_pricing_heading+.ult_price_body_block .ult_price_body {
    margin: -5px auto 15px
}
.ult_design_5 .ult_pricing_table .ult_price_features ul li {
    border-bottom: 1px solid #ededed;
    line-height: 2em;
    margin-left: 30px;
    margin-right: 30px
}
.ult_design_5 .ult_pricing_table .ult_price_link .ult_price_action_button {
    color: #fff;
    background: #555;
    border-radius: 3px;
    padding: 10px
}
.ult_design_5.ult-cs-black .ult_pricing_table .ult_pricing_heading,
.ult_design_5.ult-cs-black .ult_pricing_table .ult_price_body_block,
.ult_design_5.ult-cs-black .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #333
}
.ult_design_5.ult-cs-red .ult_pricing_table .ult_pricing_heading,
.ult_design_5.ult-cs-red .ult_pricing_table .ult_price_body_block,
.ult_design_5.ult-cs-red .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #df4130
}
.ult_design_5.ult-cs-blue .ult_pricing_table .ult_pricing_heading,
.ult_design_5.ult-cs-blue .ult_pricing_table .ult_price_body_block,
.ult_design_5.ult-cs-blue .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #2867b6
}
.ult_design_5.ult-cs-yellow .ult_pricing_table .ult_pricing_heading,
.ult_design_5.ult-cs-yellow .ult_pricing_table .ult_price_body_block,
.ult_design_5.ult-cs-yellow .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #f9b84a
}
.ult_design_5.ult-cs-green .ult_pricing_table .ult_pricing_heading,
.ult_design_5.ult-cs-green .ult_pricing_table .ult_price_body_block,
.ult_design_5.ult-cs-green .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #17924b
}
.ult_design_5.ult-cs-gray .ult_pricing_table .ult_pricing_heading,
.ult_design_5.ult-cs-gray .ult_pricing_table .ult_price_body_block,
.ult_design_5.ult-cs-gray .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #d9dee0;
    color: #5d5d5d
}
.ult_design_6 .ult_pricing_table {
    background: #FFF;
    color: #777;
    border: 1px solid #efefef
}
.ult_design_6 .ult_pricing_table a {
    color: inherit
}
.ult_design_6 .ult_pricing_table .ult_pricing_heading,
.ult_design_6 .ult_pricing_table .ult_price_body_block {
    background: #322d68;
    color: #fff
}
.ult_design_6 .ult_pricing_table .ult_price_body_block {
    height: 3em;
    margin-bottom: 3em;
    font-size: 16px
}
.ult_design_6 .ult_pricing_table .ult_price_body {
    font-size: 16px;
    width: 6em;
    height: 6em;
    padding: 0;
    line-height: 1em;
    border: 2px solid #f0f0f0;
    border-radius: 500%;
    margin: 0 auto !important;
    position: relative;
    top: 0;
    background: #FFF;
    color: #777;
    -webkit-box-shadow: 0 5px 20px #DDD inset, 0 3px 0 #999 inset;
    -moz-box-shadow: 0 5px 20px #DDD inset, 0 3px 0 #999 inset;
    -o-box-shadow: 0 5px 20px #DDD inset, 0 3px 0 #999 inset;
    -ms-box-shadow: 0 5px 20px #DDD inset, 0 3px 0 #999 inset;
    box-shadow: 0 5px 20px #DDD inset, 0 3px 0 #999 inset
}
.ult_design_6 .ult_pricing_table .ult_price_link .ult_price_action_button {
    color: #fff;
    border-radius: 15px;
    background: #444;
    background: -webkit-linear-gradient(#666, #333);
    background: -moz-linear-gradient(#666, #333);
    background: -o-linear-gradient(#666, #333);
    background: linear-gradient(#666, #333)
}
.ult_design_6.ult_featured .ult_price_body_block {
    margin-top: -5px
}
.ult_design_6.ult-cs-black .ult_pricing_table .ult_pricing_heading,
.ult_design_6.ult-cs-black .ult_pricing_table .ult_price_body_block,
.ult_design_6.ult-cs-black .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #333
}
.ult_design_6.ult-cs-red .ult_pricing_table .ult_pricing_heading,
.ult_design_6.ult-cs-red .ult_pricing_table .ult_price_body_block,
.ult_design_6.ult-cs-red .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #df4130
}
.ult_design_6.ult-cs-blue .ult_pricing_table .ult_pricing_heading,
.ult_design_6.ult-cs-blue .ult_pricing_table .ult_price_body_block,
.ult_design_6.ult-cs-blue .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #2867b6
}
.ult_design_6.ult-cs-yellow .ult_pricing_table .ult_pricing_heading,
.ult_design_6.ult-cs-yellow .ult_pricing_table .ult_price_body_block,
.ult_design_6.ult-cs-yellow .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #f9b84a
}
.ult_design_6.ult-cs-green .ult_pricing_table .ult_pricing_heading,
.ult_design_6.ult-cs-green .ult_pricing_table .ult_price_body_block,
.ult_design_6.ult-cs-green .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #17924b
}
.ult_design_6.ult-cs-gray .ult_pricing_table .ult_pricing_heading,
.ult_design_6.ult-cs-gray .ult_pricing_table .ult_price_body_block,
.ult_design_6.ult-cs-gray .ult_pricing_table .ult_price_link .ult_price_action_button {
    background: #d9dee0;
    color: #5d5d5d
}
.ult_design_2 .ult_price_table_ht .ult_price_link {
    position: relative;
}
.ult_design_2 .info_min_ht .ult_price_link {
    position: relative;
}
.ult_design_1 .ult_pricing_table .ult_price_link {
    padding-top: 15px;
}
a.ult_price_action_button {
    border: none;
}

redpajama_set_name: RedPajamaGithub


text:
package com.croeder.document_index;

public class PubMed {

}


text:
<?php

require dirname(__FILE__).'/config.php';
require $PLATFORMRUN;


text:
package reactivemongo.api

import scala.language.higherKinds

import scala.collection.generic.CanBuildFrom

import scala.concurrent.{ ExecutionContext, Future }

/**
 * Cursor over results from MongoDB.
 *
 * @tparam T the type parsed from each result document
 * @define maxDocsParam the maximum number of documents to be retrieved (-1 for unlimited)
 * @define errorHandlerParam The binary operator to be applied when failing to get the next response. Exception or [[reactivemongo.api.Cursor$.Fail Fail]] raised within the `suc` function cannot be recovered by this error handler.
 * @define collect Collects all the documents into a collection of type `M[T]`
 */
trait CursorCompatAPI[T] { _: Cursor[T] =>
  import Cursor.ErrorHandler

  /**
   * $collect.
   *
   * @param maxDocs $maxDocsParam.
   * @param err $errorHandlerParam
   *
   * {{{
   * val cursor = collection.find(query, filter).cursor[BSONDocument]()
   * // return the 3 first documents in a Vector[BSONDocument].
   * val vector = cursor.collect[Vector](3, Cursor.FailOnError[Vector[BSONDocument]]())
   * }}}
   */
  def collect[M[_]](maxDocs: Int, err: ErrorHandler[M[T]])(implicit cbf: CanBuildFrom[M[_], T, M[T]], ec: ExecutionContext): Future[M[T]]
}


text:
using System;

namespace kagv.DLL_source {
    public class GridPos : IEquatable<GridPos> {
        public int X;
        public int Y;

        public GridPos() {
            X = 0;
            Y = 0;
        }
        public GridPos(int iX, int iY) {
            X = iX;
            Y = iY;
        }

        public GridPos(GridPos b) {
            X = b.X;
            Y = b.Y;
        }

        public override int GetHashCode() {
            return X ^ Y;
        }

        public override bool Equals(Object obj) {
            // Unlikely to compare incorrect type so removed for performance
            // if (!(obj.GetType() == typeof(GridPos)))
            //     return false;
            GridPos p = (GridPos)obj;

            if (ReferenceEquals(null, p)) {
                return false;
            }

            // Return true if the fields match:
            return (X == p.X) && (Y == p.Y);
        }

        public bool Equals(GridPos p) {
            if (ReferenceEquals(null, p))
                return false;

            // Return true if the fields match:
            return (X == p.X) && (Y == p.Y);
        }

        public static bool operator ==(GridPos a, GridPos b) {
            // If both are null, or both are same instance, return true.
            if (ReferenceEquals(a, b))
                return true;
            if (ReferenceEquals(null, a))
                return false;
            if (ReferenceEquals(null, b))
                return false;

            // Return true if the fields match:
            return a.X == b.X && a.Y == b.Y;
        }

        public static bool operator !=(GridPos a, GridPos b) {
            return !(a == b);
        }

        public GridPos Set(int iX, int iY) {
            X = iX;
            Y = iY;
            return this;
        }

        public override string ToString() {
            return $"({X},{Y})";
        }
    }
}


text: launchctl load /usr/local/opt/mongodb/homebrew.mxcl.mongodb.plist


text:
layout: page
title:  "Installation"
section: "installation"
position: 2
---

[sonatype]: https://oss.sonatype.org/index.html#nexus-search;quick~platanios

# Installation

TensorFlow for Scala is currently available for Scala 2.11.x and for 2.12.x. The main line of development is version
2.12.3. Binary release artifacts are published to the [Sonatype OSS Repository Hosting service][sonatype] and synced to
Maven Central. Currently, given the beta status of this project, only snapshot releases are published.

## Using with SBT

To include the Sonatype repositories in your [SBT](http://www.scala-sbt.org) build and use TensorFlow for Scala, you
should add the following to your `build.sbt` file:

```scala
libraryDependencies += "org.platanios" %% "tensorflow" % "0.1.1"
```

**NOTE:** This requires that you have installed the TensorFlow dynamic library in your system. If you haven't, please
continue reading into the following section.

## Dependencies

### TensorFlow Dynamic Library

TensorFlow for Scala is an API for [TensorFlow](https://www.tensorflow.org). In order for it work, it requires that you
have the main TensorFlow dynamic library installed. You have two options for dealing with this requirement:

  1. Use:

     ```scala
     libraryDependencies += "org.platanios" %% "tensorflow" % "0.1.0-SNAPSHOT" classifier "linux-cpu-x86_64"
     ```

     instead of the line above, for your `build.sbt` file. *Make sure to replace `linux-cpu-x86_64` with the string
     that corresponds to your platform.* Currently supported platforms are: `linux-cpu-x86_64`, `linux-gpu-x86_64`, and
     `darwin-cpu-x86_64`. I hope to support Windows soon.
  2. Compile the TensorFlow dynamic library yourself and install it in your system. This is the recommended approach if
     you care about performance, but it is also significantly more complicated and time consuming. It consists of the
     following steps:

       1. Clone the TensorFlow repository:

          ```bash
          git clone https://github.com/tensorflow/tensorflow.git <repository_directory>
          cd <repository_directory>
          ```

       2. Compile the library using the following commands:

          ```bash
          ./configure
          bazel build --config=opt //tensorflow:libtensorflow.so
          ```

          For details regarding the configuration options (e.g., GPU support), please refer to the relevant main
          TensorFlow [documentation page](https://www.tensorflow.org/install/install_sources).
       3. Copy the `bazel-bin/tensorflow/libtensorflow.so` (possibly having  a different extension, depending on the
          platform you're using) file in a directory that is in `LD_LIBRARY_PATH`, or set `LD_LIBRARY_PATH`
          appropriately.

**NOTE:** If you want to compile TensorFlow for Scala yourself and the `libtensorflow.so` file is not placed in one of
the default system libraries directories, then set `-Djava.library.path=<directory>` (replacing `<directory>` with the
directory containing the `libtensorflow.so` file) in the `.jvmopts` file at the root of the TensorFlow for Scala
repository.

### Protocol Buffers Compiler

TensorFlow for Scala also requires `protoc`, the Protocol Buffers compiler, to be installed. You also have two options
for dealing with this requirement:

  1. Install it using a package manager:
     - On Debian/Ubuntu, you can install it with [APT](https://help.ubuntu.com/community/AptGet), using the following
       command:

       ```bash
       apt-get install protobuf-compiler
       ```
     - On Mac, you can install with [Homebrew](https://brew.sh), using the following command:

       ```bash
       brew install protobuf
       ```
  2. Download pre-built binaries from
     [https://github.com/google/protobuf/releases/](https://github.com/google/protobuf/releases/) (choose the `protoc`
     variant appropriate for your platform) and make sure that `protoc` is in the `PATH` (either by installing it in a
     location in the `PATH`, or by adding its location to the `PATH`).

**NOTE:** You need to install `protoc` with version at least 3.


text:
layout: page
title: "Pamela Diggle"
comments: true
description: "blanks"
keywords: "Pamela Diggle,CU,Boulder"
---
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://dl.dropboxusercontent.com/s/pc42nxpaw1ea4o9/highcharts.js?dl=0"></script>
<!-- <script src="../assets/js/highcharts.js"></script> -->
<style type="text/css">@font-face {
	font-family: "Bebas Neue";
	src: url(https://www.filehosting.org/file/details/544349/BebasNeue Regular.otf) format("opentype");
	}
	h1.Bebas {
		font-family: "Bebas Neue", Verdana, Tahoma;
	}
</style>
</head>

#### TEACHING INFORMATION

**College**: College of Arts and Sciences

**Classes taught**: EBIO 4510, EBIO 4550, EBIO 4800, EBIO 5000, EBIO 6000

#### EBIO 4510: PLANT ANATOMY/DEVELOPMNT

**Terms taught**: Fall 2009

**Instructor rating**: 5.52

**Standard deviation in instructor rating**: 0.0

**Average grade** (4.0 scale): 3.07

**Standard deviation in grades** (4.0 scale): 0.0

**Average workload** (raw): 2.72

**Standard deviation in workload** (raw): 0.0

#### EBIO 4550: Plant Eco-Evo-Devo

**Terms taught**: Fall 2013

**Instructor rating**: 5.16

**Standard deviation in instructor rating**: 0.0

**Average grade** (4.0 scale): 2.76

**Standard deviation in grades** (4.0 scale): 0.0

**Average workload** (raw): 2.72

**Standard deviation in workload** (raw): 0.0

#### EBIO 4800: CT-PLANT ECO-EVO-DEVO

**Terms taught**: Spring 2010

**Instructor rating**: 5.78

**Standard deviation in instructor rating**: 0.0

**Average grade** (4.0 scale): 3.31

**Standard deviation in grades** (4.0 scale): 0.0

**Average workload** (raw): 2.63

**Standard deviation in workload** (raw): 0.0

#### EBIO 5000: EBIO Colloquia

**Terms taught**: Fall 2010, Spring 2011

**Instructor rating**: 0.0

**Standard deviation in instructor rating**: 0.0

**Average grade** (4.0 scale): 4.0

**Standard deviation in grades** (4.0 scale): 0.0

**Average workload** (raw): 0.0

**Standard deviation in workload** (raw): 0.0

#### EBIO 6000: Seminar: Introduction to Biological Research

**Terms taught**: Fall 2010

**Instructor rating**: 0.0

**Standard deviation in instructor rating**: 0.0

**Average grade** (4.0 scale): 4.0

**Standard deviation in grades** (4.0 scale): 0.0

**Average workload** (raw): 0.0

**Standard deviation in workload** (raw): 0.0


text:
package com.perpetumobile.bit.orm.record.field;

import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.perpetumobile.bit.orm.record.exception.FieldTypeMismatchException;
import com.perpetumobile.bit.util.Util;

/**
 * @author Zoran Dukic
 *
 */
public class IntField extends Field {
	private static final long serialVersionUID = 1L;

	private int value = 0;
	private boolean autoIncrement = false;

	public IntField(String fieldName) {
		super(fieldName);
	}

	public IntField(String fieldName, boolean autoIncrement) {
		super(fieldName);
		this.autoIncrement = autoIncrement;
	}

	public IntField(String fieldName, int value) {
		super(fieldName);
		this.value = value;
	}

	public IntField(String fieldName, int value, boolean autoIncrement) {
		super(fieldName);
		this.value = value;
		this.autoIncrement = autoIncrement;
	}

	public IntField(ByteBuffer fieldName) {
		super(fieldName);
	}

	public IntField(ByteBuffer fieldName, boolean autoIncrement) {
		super(fieldName);
		this.autoIncrement = autoIncrement;
	}

	public IntField(ByteBuffer fieldName, int value) {
		super(fieldName);
		this.value = value;
	}

	public IntField(ByteBuffer fieldName, int value, boolean autoIncrement) {
		super(fieldName);
		this.value = value;
		this.autoIncrement = autoIncrement;
	}

	public boolean equalValue(Field f) {
		if(f instanceof IntField) {
			return value == ((IntField) f).value;
		}
		return false;
	}

	public String getFieldValue() {
		return Integer.toString(value);
	}

	public String getJSONFieldValue() {
		return getFieldValue();
	}

	public int getIntFieldValue() {
		return value;
	}

	public long getLongFieldValue() {
		return value;
	}

	public float getFloatFieldValue() {
		return value;
	}

	public double getDoubleFieldValue() {
		return value;
	}

	protected void setFieldValueImpl(String fieldValue) {
		value = Util.toInt(fieldValue);
	}

	protected void setIntFieldValueImpl(int fieldValue) {
		value = fieldValue;
	}

	public int bindImpl(ResultSet rs, int index)
	throws SQLException {
		value = rs.getInt(index++);
		return index;
	}

	public int setPreparedStatementParameter(PreparedStatement stmt, int index)
	throws SQLException {
		stmt.setInt(index++, value);
		return index;
	}

	public boolean isAutoIncrement() {
		return autoIncrement;
	}

	protected void setByteBufferFieldValueImpl(ByteBuffer fieldValue) {
		if(fieldValue.remaining() > 4 || fieldValue.remaining() < 1) {
			throw new FieldTypeMismatchException("Field Name: " + getFieldName());
		}
		value = new BigInteger(Util.toBytes(fieldValue)).intValue();
	}

	public ByteBuffer getByteBufferFieldValue() {
		return Util.toByteBuffer(value, true);
	}
}


text:
/*
 *= require jquery.bsmselect
 *= require jquery.ui.autocomplete
 *= require jquery.ui.core
 *= require jquery.ui.theme
 *= require markitup_textile
 *= require_tree .
*/


text:
/*!
	@file
	@author		Generate utility by Albert Semenov
	@date		01/2009
	@module
*/

using System;
using System.Runtime.InteropServices;

namespace MyGUI.Sharp
{
    public  class ImageBox :
		Widget
    {
        #region ImageBox

        protected override string GetWidgetType() { return "ImageBox"; }

        internal static BaseWidget RequestWrapImageBox(BaseWidget _parent, IntPtr _widget)
        {
			ImageBox widget = new ImageBox();
			widget.WrapWidget(_parent, _widget);
            return widget;
        }

        internal static BaseWidget RequestCreateImageBox(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name)
        {
			ImageBox widget = new ImageBox();
			widget.CreateWidgetImpl(_parent, _style, _skin, _coord, _align, _layer, _name);
            return widget;
        }

		#endregion

		//InsertPoint
		#region Method SetItemName

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_SetItemName__value(IntPtr _native,
			[MarshalAs(UnmanagedType.LPStr)] string _value);

		public void SetItemName(
			string _value)
		{
			ExportImageBox_SetItemName__value(Native,
				_value);
		}

		#endregion
		#region Method SetItemGroup

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_SetItemGroup__value(IntPtr _native,
			[MarshalAs(UnmanagedType.LPStr)] string _value);

		public void SetItemGroup(
			string _value)
		{
			ExportImageBox_SetItemGroup__value(Native,
				_value);
		}

		#endregion
		#region Method SetItemResource

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]

		private static extern bool ExportImageBox_SetItemResource__name(IntPtr _native,
			[MarshalAs(UnmanagedType.LPStr)] string _name);

		public bool SetItemResource(
			string _name)
		{
			return ExportImageBox_SetItemResource__name(Native,
				_name);
		}

		#endregion
		#region Method GetItemFrameRate

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]

		private static extern float ExportImageBox_GetItemFrameRate__index(IntPtr _native,
			uint _index);

		public float GetItemFrameRate(
			uint _index)
		{
			return ExportImageBox_GetItemFrameRate__index(Native,
				_index);
		}

		#endregion
		#region Method SetItemFrameRate

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_SetItemFrameRate__index__rate(IntPtr _native,
			uint _index,
			float _rate);

		public void SetItemFrameRate(
			uint _index,
			float _rate)
		{
			ExportImageBox_SetItemFrameRate__index__rate(Native,
				_index,
				_rate);
		}

		#endregion
		#region Method DeleteAllItemFrames

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_DeleteAllItemFrames__index(IntPtr _native,
			uint _index);

		public void DeleteAllItemFrames(
			uint _index)
		{
			ExportImageBox_DeleteAllItemFrames__index(Native,
				_index);
		}

		#endregion
		#region Method DeleteItemFrame

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_DeleteItemFrame__index__indexFrame(IntPtr _native,
			uint _index,
			uint _indexFrame);

		public void DeleteItemFrame(
			uint _index,
			uint _indexFrame)
		{
			ExportImageBox_DeleteItemFrame__index__indexFrame(Native,
				_index,
				_indexFrame);
		}

		#endregion
		#region Method SetItemFrame

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_SetItemFrame__index__indexFrame__item(IntPtr _native,
			uint _index,
			uint _indexFrame,
			[In] ref IntCoord _item);

		public void SetItemFrame(
			uint _index,
			uint _indexFrame,
			IntCoord _item)
		{
			ExportImageBox_SetItemFrame__index__indexFrame__item(Native,
				_index,
				_indexFrame,
				ref _item);
		}

		#endregion
		#region Method InsertItemFrameDublicate

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_InsertItemFrameDublicate__index__indexFrame__indexSourceFrame(IntPtr _native,
			uint _index,
			uint _indexFrame,
			uint _indexSourceFrame);

		public void InsertItemFrameDublicate(
			uint _index,
			uint _indexFrame,
			uint _indexSourceFrame)
		{
			ExportImageBox_InsertItemFrameDublicate__index__indexFrame__indexSourceFrame(Native,
				_index,
				_indexFrame,
				_indexSourceFrame);
		}

		#endregion
		#region Method AddItemFrameDublicate

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_AddItemFrameDublicate__index__indexSourceFrame(IntPtr _native,
			uint _index,
			uint _indexSourceFrame);

		public void AddItemFrameDublicate(
			uint _index,
			uint _indexSourceFrame)
		{
			ExportImageBox_AddItemFrameDublicate__index__indexSourceFrame(Native,
				_index,
				_indexSourceFrame);
		}

		#endregion
		#region Method InsertItemFrame

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_InsertItemFrame__index__indexFrame__item(IntPtr _native,
			uint _index,
			uint _indexFrame,
			[In] ref IntCoord _item);

		public void InsertItemFrame(
			uint _index,
			uint _indexFrame,
			IntCoord _item)
		{
			ExportImageBox_InsertItemFrame__index__indexFrame__item(Native,
				_index,
				_indexFrame,
				ref _item);
		}

		#endregion
		#region Method AddItemFrame

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_AddItemFrame__index__item(IntPtr _native,
			uint _index,
			[In] ref IntCoord _item);

		public void AddItemFrame(
			uint _index,
			IntCoord _item)
		{
			ExportImageBox_AddItemFrame__index__item(Native,
				_index,
				ref _item);
		}

		#endregion
		#region Method DeleteAllItems

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_DeleteAllItems(IntPtr _native);

		public void DeleteAllItems( )
		{
			ExportImageBox_DeleteAllItems(Native);
		}

		#endregion
		#region Method DeleteItem

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_DeleteItem__index(IntPtr _native,
			uint _index);

		public void DeleteItem(
			uint _index)
		{
			ExportImageBox_DeleteItem__index(Native,
				_index);
		}

		#endregion
		#region Method SetItem

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_SetItem__index__item(IntPtr _native,
			uint _index,
			[In] ref IntCoord _item);

		public void SetItem(
			uint _index,
			IntCoord _item)
		{
			ExportImageBox_SetItem__index__item(Native,
				_index,
				ref _item);
		}

		#endregion
		#region Method AddItem

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_AddItem__item(IntPtr _native,
			[In] ref IntCoord _item);

		public void AddItem(
			IntCoord _item)
		{
			ExportImageBox_AddItem__item(Native,
				ref _item);
		}

		#endregion
		#region Method InsertItem

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_InsertItem__index__item(IntPtr _native,
			uint _index,
			[In] ref IntCoord _item);

		public void InsertItem(
			uint _index,
			IntCoord _item)
		{
			ExportImageBox_InsertItem__index__item(Native,
				_index,
				ref _item);
		}

		#endregion
		#region Method ResetItemSelect

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_ResetItemSelect(IntPtr _native);

		public void ResetItemSelect( )
		{
			ExportImageBox_ResetItemSelect(Native);
		}

		#endregion
		#region Method SetImageTile

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_SetImageTile__value(IntPtr _native,
			ref IntSize _value);

		public void SetImageTile(
			IntSize _value)
		{
			ExportImageBox_SetImageTile__value(Native,
				ref _value);
		}

		#endregion
		#region Method SetImageCoord

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_SetImageCoord__value(IntPtr _native,
			[In] ref IntCoord _value);

		public void SetImageCoord(
			IntCoord _value)
		{
			ExportImageBox_SetImageCoord__value(Native,
				ref _value);
		}

		#endregion
		#region Method SetImageRect

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_SetImageRect__value(IntPtr _native,
			[In] ref IntRect _value);

		public void SetImageRect(
			IntRect _value)
		{
			ExportImageBox_SetImageRect__value(Native,
				ref _value);
		}

		#endregion
		#region Method SetImageTexture

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_SetImageTexture__value(IntPtr _native,
			[MarshalAs(UnmanagedType.LPStr)] string _value);

		public void SetImageTexture(
			string _value)
		{
			ExportImageBox_SetImageTexture__value(Native,
				_value);
		}

		#endregion
		#region Method SetImageInfo

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_SetImageInfo__texture__coord__tile(IntPtr _native,
			[MarshalAs(UnmanagedType.LPStr)] string _texture,
			[In] ref IntCoord _coord,
			ref IntSize _tile);

		public void SetImageInfo(
			string _texture,
			IntCoord _coord,
			IntSize _tile)
		{
			ExportImageBox_SetImageInfo__texture__coord__tile(Native,
				_texture,
				ref _coord,
				ref _tile);
		}

		#endregion
		#region Property ItemSelect

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]

		private static extern uint ExportImageBox_GetItemSelect(IntPtr _widget);
		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_SetItemSelect(IntPtr _widget, uint _value);

		public uint ItemSelect
		{
			get { return ExportImageBox_GetItemSelect(Native); }
			set { ExportImageBox_SetItemSelect(Native, value); }
		}

		#endregion
		#region Property ItemCount

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]

		private static extern uint ExportImageBox_GetItemCount(IntPtr _native);

		public uint ItemCount
		{
			get { return ExportImageBox_GetItemCount(Native); }
		}

		#endregion
		#region Property ImageSize

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]

		private static extern IntPtr ExportImageBox_GetImageSize(IntPtr _native);

		public IntSize ImageSize
		{
			get { return (IntSize)Marshal.PtrToStructure(ExportImageBox_GetImageSize(Native), typeof(IntSize)); }
		}

		#endregion
		#region Property ImageIndex

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]

		private static extern uint ExportImageBox_GetImageIndex(IntPtr _widget);
		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportImageBox_SetImageIndex(IntPtr _widget, uint _value);

		public uint ImageIndex
		{
			get { return ExportImageBox_GetImageIndex(Native); }
			set { ExportImageBox_SetImageIndex(Native, value); }
		}

		#endregion

    }
}


text:
using System.Security.Claims;

namespace Microsoft.IdentityModel.Tokens.Saml
{
    /// <summary>
    /// Defines the keys for properties contained in <see cref="Claim.Properties"/>.
    /// </summary>
    public static class ClaimProperties
    {
#pragma warning disable 1591
        public const string Namespace = "http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties";

        public const string SamlNameIdentifierFormat = Namespace + "/format";
        public const string SamlNameIdentifierNameQualifier = Namespace + "/namequalifier";
        public const string SamlNameIdentifierSPNameQualifier = Namespace + "/spnamequalifier";
        public const string SamlNameIdentifierSPProvidedId = Namespace + "/spprovidedid";
        public const string SamlSubjectConfirmationMethod = Namespace + "/confirmationmethod";
        public const string SamlSubjectConfirmationData = Namespace + "/confirmationdata";
        public const string SamlSubjectKeyInfo = Namespace + "/keyinfo";
#pragma warning restore 1591
    }
}


text:
- **`make_download`** - Code for the application's Lambda function.
- **`events`** - Invocation events that you can use to invoke the function.
- **`tests`** - Unit tests for the application code.
- **`template.yaml`** - A template that defines the application's AWS resources.
- **`Makefile`** - Makefile for your convenience to install deps, build, invoke, and deploy your application.

## Deploy the sample application

> **Already know this sample? Run: `make hurry` - This command will install app deps, build, and deploy your Serverless application using SAM.**

Build and deploy your application for the first time by running the following commands in your shell:

```bash
mpcontribs-serverless$ make build
mpcontribs-serverless$ make deploy.guided
```

The first command will **build** the source of your application within a Docker container. The second command will **package and deploy** your application to AWS. Guided deploy means SAM CLI will ask you about the name of your deployment/stack, AWS Region, and whether you want to save your choices, so that you can use `make deploy` next time.

## Use the SAM CLI to build and test locally

Whenever you change your application code, you'll have to run build command:

```bash
mpcontribs-serverless$ make build
```

The SAM CLI installs dependencies defined in `make_download/requirements.txt`, creates a deployment package, and saves it in the `.aws-sam/build` folder.

Test a single function by invoking it directly with a test event:

```bash
mpcontribs-serverless$ make invoke
```

> An event is a JSON document that represents the input that the function receives from the event source. Test events are included in the `events` folder in this project.

## Fetch, tail, and filter Lambda function logs

To simplify troubleshooting, SAM CLI has a command called `sam logs`. `sam logs` lets you fetch logs generated by your deployed Lambda function from the command line. In addition to printing the logs on the terminal, this command has several nifty features to help you quickly find the bug.

```bash
mpcontribs-serverless$ sam logs -n MPContribsMakeDownloadFunction --stack-name <Name-of-your-deployed-stack> --tail
```

## Unit tests

Tests are defined in the `tests` folder in this project, and we use Pytest as the test runner for this sample project.

Make sure you install dev dependencies before you run tests with `make dev`:

```bash
mpcontribs-serverless$ make dev
mpcontribs-serverless$ make test
```

## Cleanup

```bash
mpcontribs-serverless$ aws cloudformation delete-stack --stack-name mpcontribs-serverless
```

# Appendix

## Makefile

We included a `Makefile` for your convenience - You can find all commands you can use by running `make`. Under the hood, we're using SAM CLI commands to run these common tasks:

* **`make build`**: `sam build --use-container`
* **`make deploy.guided`**: `sam deploy --guided`
* **`make invoke`**: `sam local invoke MPContribsMakeDownloadFunction --event events/make_download.json`
* **`make run`**: `sam local start-api`

## Sync project with function dependencies

Pipenv takes care of isolating dev dependencies and app dependencies. As SAM CLI requires a `requirements.txt` file, you'd need to generate one if new app dependencies have been added:

```bash
mpcontribs-serverless$ pipenv lock -r > make_download/requirements.txt
```


text:
<!doctype html>

  <meta charset="utf-8">

  <title>matchesSelector tests</title>

  <link rel="stylesheet" href="components/qunit/qunit.css" />


text:
jQuery(function() {
	var context = jQuery( 'body' );

	Apiki.vars = {
		body : context
	};

	//set route in application
	Dispatcher( Apiki.Application, window.pagenow, [context] );
});


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Category list 2 - Listty</title>

  <link href="plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet">
  <link href="plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <link href="plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
  <link href="plugins/listtyicons/style.css" rel="stylesheet">
  <link href="plugins/bootstrapthumbnail/bootstrap-thumbnail.css" rel="stylesheet">
  <link href="plugins/datepicker/datepicker.min.css" rel="stylesheet">
  <link href="plugins/selectbox/select_option1.css" rel="stylesheet">
  <link href="plugins/owl-carousel/owl.carousel.min.css" rel="stylesheet">
  <link href="plugins/fancybox/jquery.fancybox.pack.css" rel="stylesheet">
  <link href="plugins/isotope/isotope.min.css" rel="stylesheet">
  <link href="plugins/map/css/map.css" rel="stylesheet">

  <link href="https://fonts.googleapis.com/css?family=Muli:200,300,400,600,700,800,900" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Herr+Von+Muellerhoff" rel="stylesheet">

  <link href="css/style.css" rel="stylesheet">

  <link href="img/favicon.png" rel="shortcut icon">

              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                Toggle navigation

              </button>

                        home

Map Version

Travel Version

Automobile Version

                    Listing

listing Grids

Listing Grid Left

Listing Grid Right

Listing Grid Fullwidth

listing lists

Listing list Left

Listing list Right

Listing list Full

listing Sidebar Map

Listing Sidebar Map left

Listing Sidebar Map right

Listing Sidebar Map Full

listing Details

Listing Details Left

Listing Details Right

Listing Details Full

                    pages

Contact Us

Terms and Conditions

Create Account

Login

Pricing

Payment

How It Works

blog

                    admin

Dashboard

Add Listing

Edit Listing

My Listings

My Profile

My Orders

            <button class="btn btn-default navbar-btn" type="button" data-toggle="modal" data-target="#loginModal"> + Add Listing </button>

	<form>

Find

							<input type="text" class="form-control" id="findItem" placeholder="What are you looking for?">

Near

							<input type="text" class="form-control" id="nearLocation" placeholder="Location">

Category

								<select name="guiest_id32" id="guiest_id32" class="select-drop">
									<option value="0">All Categories</option>
									<option value="1">All Categories 1</option>
									<option value="2">All Categories 2</option>
									<option value="3">All Categories 3</option>
								</select>

	</form>

We found 8 Results for you

								Verified

Glory Hole Doughnuts  10 k

1569 Queen Street West Toronto

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt  labore et dolore magna aliqua.

Hotel,

Restaurant

								Verified

Glory Hole Doughnuts  10 k

1569 Queen Street West Toronto

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt  labore et dolore magna aliqua.

Hotel,

Restaurant

								Verified

Glory Hole Doughnuts  10 k

1569 Queen Street West Toronto

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt  labore et dolore magna aliqua.

Hotel,

Restaurant

Glory Hole Doughnuts  10 k

1569 Queen Street West Toronto

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt  labore et dolore magna aliqua.

Hotel,

Restaurant

Glory Hole Doughnuts  10 k

1569 Queen Street West Toronto

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt  labore et dolore magna aliqua.

Hotel,

Restaurant

Glory Hole Doughnuts  10 k

1569 Queen Street West Toronto

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt  labore et dolore magna aliqua.

Hotel,

Restaurant

Glory Hole Doughnuts  10 k

1569 Queen Street West Toronto

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt  labore et dolore magna aliqua.

Hotel,

Restaurant

Glory Hole Doughnuts  10 k

1569 Queen Street West Toronto

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt  labore et dolore magna aliqua.

Hotel,

Restaurant

Filter by Area

Dhaka

Chittagong

Rajshahi

Khulna

Barisal

Sylhet

Rangpure

Gazipure

Pabna

Related Categories

Fast food

Chinese restaurants

Creole restaurants

Seafood

Thai restaurants

Street food

Japanese restaurants

Greek restaurants

1

2

3

4

5

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor

[88] 657 524 332

info@listy.com

Links

Dashboard

Create Account

Login

Add Listing

Edit Listing

Company

Contact Us

Terms and Conditions

How It Works

Payment

Pricing

Copyright © 2017. All Rights Reserved by Abdus

          <button type="button" class="close" data-dismiss="modal">×</button>

Log In to your Account

          <form class="loginForm">

              <input type="email" class="form-control" id="email" placeholder="Email">

              <input type="password" class="form-control" id="pwd" placeholder="Password">

              <button type="submit" class="btn btn-primary btn-block">Log In</button>

              <input type="checkbox"> Remember me
              Fogot Password?

          </form>

Don't have an Account? Sign up


text:
from PIL import Image

import serial
import time
from easygui import *

ser = serial.Serial('/dev/ttyUSB0', 57600)
ser.write(b"\xF6")
rep=ser.read(2);

reply='bho'
if rep == b'ep' :
	choices = ["Convert Image","Load Converted Image","Preview","Print","Set Burning Time","Send Laser Home", "Reset Printer","Pause","Quit"]

	while (reply != 'Quit'):
		reply = choicebox("What would you like to do?", choices=choices)

		if reply == choices[0] :

			file_path = fileopenbox()
			im = Image.open(file_path)

			im = im.resize((512,512), Image.NEAREST)
			im = im.convert('1').transpose(Image.FLIP_TOP_BOTTOM)

			im.save('converted.bmp')
			msgbox("Check converted.bmp for a (Vertically flipped) preview")
		elif reply == choices[1]:
				print('Sending converted.bmp to machine, please wait')
				ser.write(b"\xFE\xFE\xFE\xFE\xFE\xFE\xFE\xFE")
				time.sleep(3)
				print('.')
				ser.write(open("converted.bmp","rb").read())
				print('.')
				time.sleep(3)
				print('Done!')

				ser.write(b"\xF3")
		elif reply == choices[2]:
			ser.write(b"\xF4")
		elif reply == choices[3]:
			ser.write(b"\xF1")
		elif reply == choices[4]:
			#burnTime=int(input("Enter burning time (1-240) : "))
			burnTime=integerbox(msg='Enter Burning time', title='Set Burning Time', default=20, lowerbound=1, upperbound=240)
		#ser.write(b"\x10")
			if burnTime != None :
				ser.write(bytes([burnTime]))
		elif reply == choices[5]:
			ser.write(b"\xF3")
		elif reply == choices[6]:
			ser.write(b"\xF9")
		elif reply == choices[7]:
			ser.write(b"\xF2")

else :
	print('Printer not connected')