text:
using System;
using System.IO;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace WWT.Providers
{
    public class VirtualEarthDownloader : IVirtualEarthDownloader
    {
        private static readonly string[] googleTileMap = new string[] { "q", "r", "t", "s" };

        private readonly HttpClient _httpClient;

        public VirtualEarthDownloader()
        {
            _httpClient = new HttpClient();
        }

        public int GetServerID(int x, int y)
        {
            int server = (x & 1) + ((y & 1) << 1);

            return (server);
        }

        public string GetTileID(int x, int y, int level, bool GoogleStyle)
        {
            var sb = new StringBuilder();

            if (GoogleStyle)
            {
                sb.Append("t");
            }

            for (int i = level; i > 0; --i)
            {
                int mask = 1 << (i - 1);
                int val = 0;

                if ((x & mask) != 0)
                    val = 1;

                if ((y & mask) != 0)
                    val += 2;
                if (GoogleStyle)
                {
                    sb.Append(googleTileMap[val]);
                }
                else
                {
                    sb.Append(val);
                }
            }
            return (sb.ToString());
        }

        public int GetTileAddressFromVEKey(string veKey, out int x, out int y)
        {
            int tileX = 0;
            int tileY = 0;
            int addValue = 1;
            int level = 0;
            while (veKey.Length > 0)
            {
                int val = Convert.ToInt32(veKey.Substring(veKey.Length - 1, 1));

                switch (val)
                {
                    case 0:
                        break;
                    case 1:
                        tileX += addValue;
                        break;
                    case 2:
                        tileY += addValue;
                        break;
                    case 3:
                        tileX += addValue;
                        tileY += addValue;
                        break;

                }
                addValue *= 2;
                level++;
                if (veKey.Length > 1)
                {
                    veKey = veKey.Substring(0, veKey.Length - 1);
                }
                else
                {
                    veKey = "";
                }
            }
            x = tileX;
            y = tileY;
            return level;
        }

        public Task<Stream> DownloadVeTileAsync(VirtualEarthTile tileType, int level, int tileX, int tileY, CancellationToken token)
        {
            var id = GetTileID(tileX, tileY, level, false);
            var server = GetServerID(tileX, tileY);
            var url = tileType switch
            {
                VirtualEarthTile.Ortho => $"http://a{server}.ortho.tiles.virtualearth.net/tiles/a{id}.jpeg?g=15",
                VirtualEarthTile.Ecn => $"http://ecn.t{server}.tiles.virtualearth.net/tiles/d{id}.elv?g=1&n=z",
                _ => throw new NotImplementedException()
            };

            return _httpClient.GetStreamAsync(url);
        }
    }
}


text:
/* NOTE: This is an internal header file, included by other STL headers.
 *   You should not attempt to use it directly.
 */

#ifndef __SGI_STL_INTERNAL_ALLOC_H
#define __SGI_STL_INTERNAL_ALLOC_H

#ifdef __SUNPRO_CC
#  define __PRIVATE public
   // Extra access restrictions prevent us from really making some things
   // private.
#else
#  define __PRIVATE private
#endif

#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG
#  define __USE_MALLOC
#endif

// This implements some standard node allocators.  These are
// NOT the same as the allocators in the C++ draft standard or in
// in the original STL.  They do not encapsulate different pointer
// types; indeed we assume that there is only one pointer type.
// The allocation primitives are intended to allocate individual objects,
// not larger arenas as with the original STL allocators.

#ifdef STM32PLUS_BUILD
#define __THROW_BAD_ALLOC { for(;;); }    // this will intentionally hang the MCU
#else
#ifndef __THROW_BAD_ALLOC
#  if defined(__STL_NO_BAD_ALLOC) || !defined(__STL_USE_EXCEPTIONS)
#    include <stdio.h>
#    include <stdlib.h>
#    define __THROW_BAD_ALLOC fprintf(stderr, "out of memory\n"); exit(1)
#  else /* Standard conforming out-of-memory handling */
#    include <new>
#    define __THROW_BAD_ALLOC throw std::bad_alloc()
#  endif
#endif
#endif

#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#ifndef __RESTRICT
#  define __RESTRICT
#endif

#ifdef __STL_THREADS
# include <stl_threads.h>
# define __NODE_ALLOCATOR_THREADS true
# ifdef __STL_SGI_THREADS
  // We test whether threads are in use before locking.
  // Perhaps this should be moved into stl_threads.h, but that
  // probably makes it harder to avoid the procedure call when
  // it isn't needed.
    extern "C" {
      extern int __us_rsthread_malloc;
    }
  // The above is copied from malloc.h.  Including <malloc.h>
  // would be cleaner but fails with certain levels of standard
  // conformance.
#   define __NODE_ALLOCATOR_LOCK if (threads && __us_rsthread_malloc) \
                { _S_node_allocator_lock._M_acquire_lock(); }
#   define __NODE_ALLOCATOR_UNLOCK if (threads && __us_rsthread_malloc) \
                { _S_node_allocator_lock._M_release_lock(); }
# else /* !__STL_SGI_THREADS */
#   define __NODE_ALLOCATOR_LOCK \
        { if (threads) _S_node_allocator_lock._M_acquire_lock(); }
#   define __NODE_ALLOCATOR_UNLOCK \
        { if (threads) _S_node_allocator_lock._M_release_lock(); }
# endif
#else
//  Thread-unsafe
#   define __NODE_ALLOCATOR_LOCK
#   define __NODE_ALLOCATOR_UNLOCK
#   define __NODE_ALLOCATOR_THREADS false
#endif

__STL_BEGIN_NAMESPACE

#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma set woff 1174
#endif

#ifdef STM32PLUS_BUILD
#define stm32_malloc malloc
#define stm32_free free
#define stm32_realloc realloc
#endif

// Malloc-based allocator.  Typically slower than default below.
// Typically thread-safe and more storage efficient.
#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG
# ifdef __DECLARE_GLOBALS_HERE
    void (* __malloc_alloc_oom_handler)() = 0;
    // g++ 2.7.2 does not handle static template data members.
# else
    extern void (* __malloc_alloc_oom_handler)();
# endif
#endif

template <int __inst>
class __malloc_alloc_template {

private:

  static void* _S_oom_malloc(size_t);
  static void* _S_oom_realloc(void*, size_t);

#ifndef __STL_STATIC_TEMPLATE_MEMBER_BUG
  static void (* __malloc_alloc_oom_handler)();
#endif

public:

  static void* allocate(size_t __n)
  {
    void* __result = stm32_malloc(__n);
    if (0 == __result) __result = _S_oom_malloc(__n);
    return __result;
  }

  static void deallocate(void* __p, size_t /* __n */)
  {
    stm32_free(__p);
  }

  static void* reallocate(void* __p, size_t /* old_sz */, size_t __new_sz)
  {
    void* __result = stm32_realloc(__p, __new_sz);
    if (0 == __result) __result = _S_oom_realloc(__p, __new_sz);
    return __result;
  }

  static void (* __set_malloc_handler(void (*__f)()))()
  {
    void (* __old)() = __malloc_alloc_oom_handler;
    __malloc_alloc_oom_handler = __f;
    return(__old);
  }

};

// malloc_alloc out-of-memory handling

#ifndef __STL_STATIC_TEMPLATE_MEMBER_BUG
template <int __inst>
void (* __malloc_alloc_template<__inst>::__malloc_alloc_oom_handler)() = 0;
#endif

template <int __inst>
void*
__malloc_alloc_template<__inst>::_S_oom_malloc(size_t __n)
{
    void (* __my_malloc_handler)();
    void* __result;

    for (;;) {
        __my_malloc_handler = __malloc_alloc_oom_handler;
        if (0 == __my_malloc_handler) { __THROW_BAD_ALLOC; }
        (*__my_malloc_handler)();
        __result = malloc(__n);
        if (__result) return(__result);
    }
}

template <int __inst>
void* __malloc_alloc_template<__inst>::_S_oom_realloc(void* __p, size_t __n)
{
    void (* __my_malloc_handler)();
    void* __result;

    for (;;) {
        __my_malloc_handler = __malloc_alloc_oom_handler;
        if (0 == __my_malloc_handler) { __THROW_BAD_ALLOC; }
        (*__my_malloc_handler)();
        __result = realloc(__p, __n);
        if (__result) return(__result);
    }
}

typedef __malloc_alloc_template<0> malloc_alloc;

template<class _Tp, class _Alloc>
class simple_alloc {

public:
    static _Tp* allocate(size_t __n)
      { return 0 == __n ? 0 : (_Tp*) _Alloc::allocate(__n * sizeof (_Tp)); }
    static _Tp* allocate(void)
      { return (_Tp*) _Alloc::allocate(sizeof (_Tp)); }
    static void deallocate(_Tp* __p, size_t __n)
      { if (0 != __n) _Alloc::deallocate(__p, __n * sizeof (_Tp)); }
    static void deallocate(_Tp* __p)
      { _Alloc::deallocate(__p, sizeof (_Tp)); }
};

// Allocator adaptor to check size arguments for debugging.
// Reports errors using assert.  Checking can be disabled with
// NDEBUG, but it's far better to just use the underlying allocator
// instead when no checking is desired.
// There is some evidence that this can confuse Purify.
template <class _Alloc>
class debug_alloc {

private:

  enum {_S_extra = 8};  // Size of space used to store size.  Note
                        // that this must be large enough to preserve
                        // alignment.

public:

  static void* allocate(size_t __n)
  {
    char* __result = (char*)_Alloc::allocate(__n + (int) _S_extra);
    *(size_t*)__result = __n;
    return __result + (int) _S_extra;
  }

  static void deallocate(void* __p, size_t __n)
  {
    char* __real_p = (char*)__p - (int) _S_extra;
    assert(*(size_t*)__real_p == __n);
    _Alloc::deallocate(__real_p, __n + (int) _S_extra);
  }

  static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz)
  {
    char* __real_p = (char*)__p - (int) _S_extra;
    assert(*(size_t*)__real_p == __old_sz);
    char* __result = (char*)
      _Alloc::reallocate(__real_p, __old_sz + (int) _S_extra,
                                   __new_sz + (int) _S_extra);
    *(size_t*)__result = __new_sz;
    return __result + (int) _S_extra;
  }

};

# ifdef __USE_MALLOC

typedef malloc_alloc alloc;
typedef malloc_alloc single_client_alloc;

# else

// Default node allocator.
// With a reasonable compiler, this should be roughly as fast as the
// original STL class-specific allocators, but with less fragmentation.
// Default_alloc_template parameters are experimental and MAY
// DISAPPEAR in the future.  Clients should just use alloc for now.
//
// Important implementation properties:
// 1. If the client request an object of size > _MAX_BYTES, the resulting
//    object will be obtained directly from malloc.
// 2. In all other cases, we allocate an object of size exactly
//    _S_round_up(requested_size).  Thus the client has enough size
//    information that we can return the object to the proper free list
//    without permanently losing part of the object.
//

// The first template parameter specifies whether more than one thread
// may use this allocator.  It is safe to allocate an object from
// one instance of a default_alloc and deallocate it with another
// one.  This effectively transfers its ownership to the second one.
// This may have undesirable effects on reference locality.
// The second parameter is unreferenced and serves only to allow the
// creation of multiple default_alloc instances.
// Node that containers built on different allocator instances have
// different types, limiting the utility of this approach.

#if defined(__SUNPRO_CC) || defined(__GNUC__)
// breaks if we make these template class members:
  enum {_ALIGN = 8};
  enum {_MAX_BYTES = 128};
  enum {_NFREELISTS = 16}; // _MAX_BYTES/_ALIGN
#endif

template <bool threads, int inst>
class __default_alloc_template {

private:
  // Really we should use static const int x = N
  // instead of enum { x = N }, but few compilers accept the former.
#if ! (defined(__SUNPRO_CC) || defined(__GNUC__))
    enum {_ALIGN = 8};
    enum {_MAX_BYTES = 128};
    enum {_NFREELISTS = 16}; // _MAX_BYTES/_ALIGN
# endif
  static size_t
  _S_round_up(size_t __bytes)
    { return (((__bytes) + (size_t) _ALIGN-1) & ~((size_t) _ALIGN - 1)); }

__PRIVATE:
  union _Obj {
        union _Obj* _M_free_list_link;
        char _M_client_data[1];    /* The client sees this.        */
  };
private:
# if defined(__SUNPRO_CC) || defined(__GNUC__) || defined(__HP_aCC)
    static _Obj* __STL_VOLATILE _S_free_list[];
        // Specifying a size results in duplicate def for 4.1
# else
    static _Obj* __STL_VOLATILE _S_free_list[_NFREELISTS];
# endif
  static  size_t _S_freelist_index(size_t __bytes) {
        return (((__bytes) + (size_t)_ALIGN-1)/(size_t)_ALIGN - 1);
  }

  // Returns an object of size __n, and optionally adds to size __n free list.
  static void* _S_refill(size_t __n);
  // Allocates a chunk for nobjs of size size.  nobjs may be reduced
  // if it is inconvenient to allocate the requested number.
  static char* _S_chunk_alloc(size_t __size, int& __nobjs);

  // Chunk allocation state.
  static char* _S_start_free;
  static char* _S_end_free;
  static size_t _S_heap_size;

# ifdef __STL_THREADS
    static _STL_mutex_lock _S_node_allocator_lock;
# endif

    // It would be nice to use _STL_auto_lock here.  But we
    // don't need the nullptr check.  And we do need a test whether
    // threads have actually been started.
    class _Lock;
    friend class _Lock;
    class _Lock {
        public:
            _Lock() { __NODE_ALLOCATOR_LOCK; }
            ~_Lock() { __NODE_ALLOCATOR_UNLOCK; }
    };

public:

  /* __n must be > 0      */
  static void* allocate(size_t __n)
  {
    void* __ret = 0;

    if (__n > (size_t) _MAX_BYTES) {
      __ret = malloc_alloc::allocate(__n);
    }
    else {
      _Obj* __STL_VOLATILE* __my_free_list
          = _S_free_list + _S_freelist_index(__n);
      // Acquire the lock here with a constructor call.
      // This ensures that it is released in exit or during stack
      // unwinding.
#     ifndef _NOTHREADS
      /*REFERENCED*/
      _Lock __lock_instance;
#     endif
      _Obj* __RESTRICT __result = *__my_free_list;
      if (__result == 0)
        __ret = _S_refill(_S_round_up(__n));
      else {
        *__my_free_list = __result -> _M_free_list_link;
        __ret = __result;
      }
    }

    return __ret;
  };

  /* __p may not be 0 */
  static void deallocate(void* __p, size_t __n)
  {
    if (__n > (size_t) _MAX_BYTES)
      malloc_alloc::deallocate(__p, __n);
    else {
      _Obj* __STL_VOLATILE*  __my_free_list
          = _S_free_list + _S_freelist_index(__n);
      _Obj* __q = (_Obj*)__p;

      // acquire lock
#       ifndef _NOTHREADS
      /*REFERENCED*/
      _Lock __lock_instance;
#       endif /* _NOTHREADS */
      __q -> _M_free_list_link = *__my_free_list;
      *__my_free_list = __q;
      // lock is released here
    }
  }

  static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz);

} ;

typedef __default_alloc_template<__NODE_ALLOCATOR_THREADS, 0> alloc;
typedef __default_alloc_template<false, 0> single_client_alloc;

template <bool __threads, int __inst>
inline bool operator==(const __default_alloc_template<__threads, __inst>&,
                       const __default_alloc_template<__threads, __inst>&)
{
  return true;
}

# ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <bool __threads, int __inst>
inline bool operator!=(const __default_alloc_template<__threads, __inst>&,
                       const __default_alloc_template<__threads, __inst>&)
{
  return false;
}
# endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */

/* We allocate memory in large chunks in order to avoid fragmenting     */
/* the malloc heap too much.                                            */
/* We assume that size is properly aligned.                             */
/* We hold the allocation lock.                                         */
template <bool __threads, int __inst>
char*
__default_alloc_template<__threads, __inst>::_S_chunk_alloc(size_t __size,
                                                            int& __nobjs)
{
    char* __result;
    size_t __total_bytes = __size * __nobjs;
    size_t __bytes_left = _S_end_free - _S_start_free;

    if (__bytes_left >= __total_bytes) {
        __result = _S_start_free;
        _S_start_free += __total_bytes;
        return(__result);
    } else if (__bytes_left >= __size) {
        __nobjs = (int)(__bytes_left/__size);
        __total_bytes = __size * __nobjs;
        __result = _S_start_free;
        _S_start_free += __total_bytes;
        return(__result);
    } else {
        size_t __bytes_to_get =
    2 * __total_bytes + _S_round_up(_S_heap_size >> 4);
        // Try to make use of the left-over piece.
        if (__bytes_left > 0) {
            _Obj* __STL_VOLATILE* __my_free_list =
                        _S_free_list + _S_freelist_index(__bytes_left);

            ((_Obj*)_S_start_free) -> _M_free_list_link = *__my_free_list;
            *__my_free_list = (_Obj*)_S_start_free;
        }
        _S_start_free = (char*)malloc(__bytes_to_get);
        if (0 == _S_start_free) {
            size_t __i;
            _Obj* __STL_VOLATILE* __my_free_list;
      _Obj* __p;
            // Try to make do with what we have.  That can't
            // hurt.  We do not try smaller requests, since that tends
            // to result in disaster on multi-process machines.
            for (__i = __size;
                 __i <= (size_t) _MAX_BYTES;
                 __i += (size_t) _ALIGN) {
                __my_free_list = _S_free_list + _S_freelist_index(__i);
                __p = *__my_free_list;
                if (0 != __p) {
                    *__my_free_list = __p -> _M_free_list_link;
                    _S_start_free = (char*)__p;
                    _S_end_free = _S_start_free + __i;
                    return(_S_chunk_alloc(__size, __nobjs));
                    // Any leftover piece will eventually make it to the
                    // right free list.
                }
            }
      _S_end_free = 0;  // In case of exception.
            _S_start_free = (char*)malloc_alloc::allocate(__bytes_to_get);
            // This should either throw an
            // exception or remedy the situation.  Thus we assume it
            // succeeded.
        }
        _S_heap_size += __bytes_to_get;
        _S_end_free = _S_start_free + __bytes_to_get;
        return(_S_chunk_alloc(__size, __nobjs));
    }
}

/* Returns an object of size __n, and optionally adds to size __n free list.*/
/* We assume that __n is properly aligned.                                */
/* We hold the allocation lock.                                         */
template <bool __threads, int __inst>
void*
__default_alloc_template<__threads, __inst>::_S_refill(size_t __n)
{
    int __nobjs = 20;
    char* __chunk = _S_chunk_alloc(__n, __nobjs);
    _Obj* __STL_VOLATILE* __my_free_list;
    _Obj* __result;
    _Obj* __current_obj;
    _Obj* __next_obj;
    int __i;

    if (1 == __nobjs) return(__chunk);
    __my_free_list = _S_free_list + _S_freelist_index(__n);

    /* Build free list in chunk */
      __result = (_Obj*)__chunk;
      *__my_free_list = __next_obj = (_Obj*)(__chunk + __n);
      for (__i = 1; ; __i++) {
        __current_obj = __next_obj;
        __next_obj = (_Obj*)((char*)__next_obj + __n);
        if (__nobjs - 1 == __i) {
            __current_obj -> _M_free_list_link = 0;
            break;
        } else {
            __current_obj -> _M_free_list_link = __next_obj;
        }
      }
    return(__result);
}

template <bool threads, int inst>
void*
__default_alloc_template<threads, inst>::reallocate(void* __p,
                                                    size_t __old_sz,
                                                    size_t __new_sz)
{
    void* __result;
    size_t __copy_sz;

    if (__old_sz > (size_t) _MAX_BYTES && __new_sz > (size_t) _MAX_BYTES) {
        return(realloc(__p, __new_sz));
    }
    if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p);
    __result = allocate(__new_sz);
    __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
    memcpy(__result, __p, __copy_sz);
    deallocate(__p, __old_sz);
    return(__result);
}

#ifdef __STL_THREADS
    template <bool __threads, int __inst>
    _STL_mutex_lock
    __default_alloc_template<__threads, __inst>::_S_node_allocator_lock
        __STL_MUTEX_INITIALIZER;
#endif

template <bool __threads, int __inst>
char* __default_alloc_template<__threads, __inst>::_S_start_free = 0;

template <bool __threads, int __inst>
char* __default_alloc_template<__threads, __inst>::_S_end_free = 0;

template <bool __threads, int __inst>
size_t __default_alloc_template<__threads, __inst>::_S_heap_size = 0;

template <bool __threads, int __inst>
typename __default_alloc_template<__threads, __inst>::_Obj* __STL_VOLATILE
__default_alloc_template<__threads, __inst> ::_S_free_list[
# if defined(__SUNPRO_CC) || defined(__GNUC__) || defined(__HP_aCC)
    _NFREELISTS
# else
    __default_alloc_template<__threads, __inst>::_NFREELISTS
# endif
] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
// The 16 zeros are necessary to make version 4.1 of the SunPro
// compiler happy.  Otherwise it appears to allocate too little
// space for the array.

#endif /* ! __USE_MALLOC */

// This implements allocators as specified in the C++ standard.
//
// Note that standard-conforming allocators use many language features
// that are not yet widely implemented.  In particular, they rely on
// member templates, partial specialization, partial ordering of function
// templates, the typename keyword, and the use of the template keyword
// to refer to a template member of a dependent type.

#ifdef __STL_USE_STD_ALLOCATORS

template <class _Tp>
class allocator {
  typedef alloc _Alloc;          // The underlying allocator.
public:
  typedef size_t     size_type;
  typedef ptrdiff_t  difference_type;
  typedef _Tp*       pointer;
  typedef const _Tp* const_pointer;
  typedef _Tp&       reference;
  typedef const _Tp& const_reference;
  typedef _Tp        value_type;

  template <class _Tp1> struct rebind {
    typedef allocator<_Tp1> other;
  };

  allocator() __STL_NOTHROW {}
  allocator(const allocator&) __STL_NOTHROW {}
  template <class _Tp1> allocator(const allocator<_Tp1>&) __STL_NOTHROW {}
  ~allocator() __STL_NOTHROW {}

  pointer address(reference __x) const { return &__x; }
  const_pointer address(const_reference __x) const { return &__x; }

  // __n is permitted to be 0.  The C++ standard says nothing about what
  // the return value is when __n == 0.
  _Tp* allocate(size_type __n, const void* = 0) {
    return __n != 0 ? static_cast<_Tp*>(_Alloc::allocate(__n * sizeof(_Tp)))
                    : 0;
  }

  // __p is not permitted to be a null pointer.
  void deallocate(pointer __p, size_type __n)
    { _Alloc::deallocate(__p, __n * sizeof(_Tp)); }

  size_type max_size() const __STL_NOTHROW
    { return size_t(-1) / sizeof(_Tp); }

  void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
  void destroy(pointer __p) { __p->~_Tp(); }
};

template<>
class allocator<void> {
public:
  typedef size_t      size_type;
  typedef ptrdiff_t   difference_type;
  typedef void*       pointer;
  typedef const void* const_pointer;
  typedef void        value_type;

  template <class _Tp1> struct rebind {
    typedef allocator<_Tp1> other;
  };
};

template <class _T1, class _T2>
inline bool operator==(const allocator<_T1>&, const allocator<_T2>&)
{
  return true;
}

template <class _T1, class _T2>
inline bool operator!=(const allocator<_T1>&, const allocator<_T2>&)
{
  return false;
}

// Allocator adaptor to turn an SGI-style allocator (e.g. alloc, malloc_alloc)
// into a standard-conforming allocator.   Note that this adaptor does
// *not* assume that all objects of the underlying alloc class are
// identical, nor does it assume that all of the underlying alloc's
// member functions are static member functions.  Note, also, that
// __allocator<_Tp, alloc> is essentially the same thing as allocator<_Tp>.

template <class _Tp, class _Alloc>
struct __allocator {
  _Alloc __underlying_alloc;

  typedef size_t    size_type;
  typedef ptrdiff_t difference_type;
  typedef _Tp*       pointer;
  typedef const _Tp* const_pointer;
  typedef _Tp&       reference;
  typedef const _Tp& const_reference;
  typedef _Tp        value_type;

  template <class _Tp1> struct rebind {
    typedef __allocator<_Tp1, _Alloc> other;
  };

  __allocator() __STL_NOTHROW {}
  __allocator(const __allocator& __a) __STL_NOTHROW
    : __underlying_alloc(__a.__underlying_alloc) {}
  template <class _Tp1>
  __allocator(const __allocator<_Tp1, _Alloc>& __a) __STL_NOTHROW
    : __underlying_alloc(__a.__underlying_alloc) {}
  ~__allocator() __STL_NOTHROW {}

  pointer address(reference __x) const { return &__x; }
  const_pointer address(const_reference __x) const { return &__x; }

  // __n is permitted to be 0.
  _Tp* allocate(size_type __n, const void* = 0) {
    return __n != 0
        ? static_cast<_Tp*>(__underlying_alloc.allocate(__n * sizeof(_Tp)))
        : 0;
  }

  // __p is not permitted to be a null pointer.
  void deallocate(pointer __p, size_type __n)
    { __underlying_alloc.deallocate(__p, __n * sizeof(_Tp)); }

  size_type max_size() const __STL_NOTHROW
    { return size_t(-1) / sizeof(_Tp); }

  void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
  void destroy(pointer __p) { __p->~_Tp(); }
};

template <class _Alloc>
class __allocator<void, _Alloc> {
  typedef size_t      size_type;
  typedef ptrdiff_t   difference_type;
  typedef void*       pointer;
  typedef const void* const_pointer;
  typedef void        value_type;

  template <class _Tp1> struct rebind {
    typedef __allocator<_Tp1, _Alloc> other;
  };
};

template <class _Tp, class _Alloc>
inline bool operator==(const __allocator<_Tp, _Alloc>& __a1,
                       const __allocator<_Tp, _Alloc>& __a2)
{
  return __a1.__underlying_alloc == __a2.__underlying_alloc;
}

#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Tp, class _Alloc>
inline bool operator!=(const __allocator<_Tp, _Alloc>& __a1,
                       const __allocator<_Tp, _Alloc>& __a2)
{
  return __a1.__underlying_alloc != __a2.__underlying_alloc;
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */

// Comparison operators for all of the predifined SGI-style allocators.
// This ensures that __allocator<malloc_alloc> (for example) will
// work correctly.

template <int inst>
inline bool operator==(const __malloc_alloc_template<inst>&,
                       const __malloc_alloc_template<inst>&)
{
  return true;
}

#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <int __inst>
inline bool operator!=(const __malloc_alloc_template<__inst>&,
                       const __malloc_alloc_template<__inst>&)
{
  return false;
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */

template <class _Alloc>
inline bool operator==(const debug_alloc<_Alloc>&,
                       const debug_alloc<_Alloc>&) {
  return true;
}

#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Alloc>
inline bool operator!=(const debug_alloc<_Alloc>&,
                       const debug_alloc<_Alloc>&) {
  return false;
}
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */

// Another allocator adaptor: _Alloc_traits.  This serves two
// purposes.  First, make it possible to write containers that can use
// either SGI-style allocators or standard-conforming allocator.
// Second, provide a mechanism so that containers can query whether or
// not the allocator has distinct instances.  If not, the container
// can avoid wasting a word of memory to store an empty object.

// This adaptor uses partial specialization.  The general case of
// _Alloc_traits<_Tp, _Alloc> assumes that _Alloc is a
// standard-conforming allocator, possibly with non-equal instances
// and non-static members.  (It still behaves correctly even if _Alloc
// has static member and if all instances are equal.  Refinements
// affect performance, not correctness.)

// There are always two members: allocator_type, which is a standard-
// conforming allocator type for allocating objects of type _Tp, and
// _S_instanceless, a static const member of type bool.  If
// _S_instanceless is true, this means that there is no difference
// between any two instances of type allocator_type.  Furthermore, if
// _S_instanceless is true, then _Alloc_traits has one additional
// member: _Alloc_type.  This type encapsulates allocation and
// deallocation of objects of type _Tp through a static interface; it
// has two member functions, whose signatures are
//    static _Tp* allocate(size_t)
//    static void deallocate(_Tp*, size_t)

// The fully general version.

template <class _Tp, class _Allocator>
struct _Alloc_traits
{
  static const bool _S_instanceless = false;
  typedef typename _Allocator::__STL_TEMPLATE rebind<_Tp>::other
          allocator_type;
};

template <class _Tp, class _Allocator>
const bool _Alloc_traits<_Tp, _Allocator>::_S_instanceless;

// The version for the default allocator.

template <class _Tp, class _Tp1>
struct _Alloc_traits<_Tp, allocator<_Tp1> >
{
  static const bool _S_instanceless = true;
#ifdef STM32PLUS_BUILD
  typedef simple_alloc<_Tp, malloc_alloc> _Alloc_type;
#else
  typedef simple_alloc<_Tp, alloc> _Alloc_type;
#endif
  typedef allocator<_Tp> allocator_type;
};

// Versions for the predefined SGI-style allocators.

template <class _Tp, int __inst>
struct _Alloc_traits<_Tp, __malloc_alloc_template<__inst> >
{
  static const bool _S_instanceless = true;
  typedef simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type;
  typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type;
};

template <class _Tp, bool __threads, int __inst>
struct _Alloc_traits<_Tp, __default_alloc_template<__threads, __inst> >
{
  static const bool _S_instanceless = true;
  typedef simple_alloc<_Tp, __default_alloc_template<__threads, __inst> >
          _Alloc_type;
  typedef __allocator<_Tp, __default_alloc_template<__threads, __inst> >
          allocator_type;
};

template <class _Tp, class _Alloc>
struct _Alloc_traits<_Tp, debug_alloc<_Alloc> >
{
  static const bool _S_instanceless = true;
  typedef simple_alloc<_Tp, debug_alloc<_Alloc> > _Alloc_type;
  typedef __allocator<_Tp, debug_alloc<_Alloc> > allocator_type;
};

// Versions for the __allocator adaptor used with the predefined
// SGI-style allocators.

template <class _Tp, class _Tp1, int __inst>
struct _Alloc_traits<_Tp,
                     __allocator<_Tp1, __malloc_alloc_template<__inst> > >
{
  static const bool _S_instanceless = true;
  typedef simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type;
  typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type;
};

template <class _Tp, class _Tp1, bool __thr, int __inst>
struct _Alloc_traits<_Tp,
                      __allocator<_Tp1,
                                  __default_alloc_template<__thr, __inst> > >
{
  static const bool _S_instanceless = true;
  typedef simple_alloc<_Tp, __default_alloc_template<__thr,__inst> >
          _Alloc_type;
  typedef __allocator<_Tp, __default_alloc_template<__thr,__inst> >
          allocator_type;
};

template <class _Tp, class _Tp1, class _Alloc>
struct _Alloc_traits<_Tp, __allocator<_Tp1, debug_alloc<_Alloc> > >
{
  static const bool _S_instanceless = true;
  typedef simple_alloc<_Tp, debug_alloc<_Alloc> > _Alloc_type;
  typedef __allocator<_Tp, debug_alloc<_Alloc> > allocator_type;
};

#endif /* __STL_USE_STD_ALLOCATORS */

#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma reset woff 1174
#endif

__STL_END_NAMESPACE

#undef __PRIVATE

#endif /* __SGI_STL_INTERNAL_ALLOC_H */

// Local Variables:
// mode:C++
// End:

redpajama_set_name: RedPajamaGithub


text:
<?php
	//Clase para la carga de las Vistas
	//$view_manager = new Pelicula_View($vista);
	//$view_manager->carga_template($data);

class Cliente_View {
	protected $vista_nombre;

	function __construct($vista) {
		$this->vista = $vista;
	}

	public function carga_template($data) {
		//echo "vi ", $data['vista'], " agregar ";
		$path_paltilla = '../html/view_template.html';

		require_once($path_paltilla);
	}
}
?>


text:
require 'rails_helper'

RSpec.describe UsersController, type: :controller do
  before do
    @user = User.create!(user_attributes)
  end

  context "when not signed in" do

  before do
    session[:user_id] = nil
  end

  it "cannot access index" do
    get :index

    expect(response).to redirect_to(new_session_url)
  end

  it "cannot access show" do
    get :show, params: { id: @user }

    expect(response).to redirect_to(new_session_url)
  end

  it "cannot access edit" do
    get :edit, params: { id: @user }

    expect(response).to redirect_to(new_session_url)
  end

  it "cannot access update" do
    patch :update, params: { id: @user }

    expect(response).to redirect_to(new_session_url)
  end

  it "cannot access destroy" do
    delete :destroy, params: { id: @user }

    expect(response).to redirect_to(new_session_url)
  end

  end

  context "when signed in as the wrong user" do

    before do
      @wrong_user = User.create!(user_attributes(email: "wrong@example.com", username: "AnotherName"))
      session[:user_id] = @wrong_user.id
    end

    it "cannot edit another user" do
      get :edit, params: { id: @user }

      expect(response).to redirect_to(root_url)
    end

    it "cannot update another user" do
      patch :update, params: { id: @user }

      expect(response).to redirect_to(root_url)
    end

    it "cannot destroy another user" do
      delete :destroy, params: { id: @user }

      expect(response).to redirect_to(root_url)
    end

  end
end


text:
package com.ubeeko.exceptions

trait MismatchedDialectVersionException extends TechnicalException with RetryableException

object MismatchedDialectVersionException {
  def apply(message: String, cause: Throwable = null) =
    new Exception(message, cause) with MismatchedDialectVersionException
}


text: Hybride XML-Dateien haben sowohl strukturierte, als auch unstrukturierte Daten.


text:
package io.crate.action.sql;

import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.client.Client;

public class SQLBulkRequestBuilder extends ActionRequestBuilder<SQLBulkRequest, SQLBulkResponse, SQLBulkRequestBuilder, Client> {

    public SQLBulkRequestBuilder(Client client) {
        super(client, new SQLBulkRequest());
    }

    @Override
    protected void doExecute(ActionListener<SQLBulkResponse> listener) {
        client.execute(SQLBulkAction.INSTANCE, request, listener);
    }

    public void stmt(String stmt) {
        request.stmt(stmt);
    }

    public void bulkArgs(Object[][] bulkArgs) {
        request.bulkArgs(bulkArgs);
    }

    public void includeTypesOnResponse(boolean includeTypes) {
        request.includeTypesOnResponse(includeTypes);
    }

    public void addFlagsToRequestHeader(int flags) {
        request.putHeader(request.FLAGS_HEADER_KEY, flags);
    }
}


text:
(function() {
  angular.module('app', ['builder', 'builder.components', 'validator.rules']).run([
    '$builder', function($builder) {
      $builder.registerComponent('sampleInput', {
        group: 'from html',
        label: 'Sample',
        description: 'From html template',
        placeholder: 'placeholder',
        required: false,
        validationOptions: [
          {
            label: 'none',
            rule: '/.*/'
          }, {
            label: 'number',
            rule: '[number]'
          }, {
            label: 'email',
            rule: '[email]'
          }, {
            label: 'url',
            rule: '[url]'
          }
        ],
        templateUrl: 'example/template.html',
        popoverTemplateUrl: 'example/popoverTemplate.html'
      });
      return $builder.registerComponent('name', {
        group: 'Default',
        label: 'Name',
        required: false,
        arrayToText: true,
        template: "
\n    {{label}}\n
\n        <input type='hidden' ng-model=\"inputText\" validator-required=\"{{required}}\" validator-group=\"{{formName}}\"/>\n
\n            <input type=\"text\"\n                ng-model=\"inputArray[0]\"\n                class=\"form-control\" id=\"{{formName+index}}-0\"/>\n
First name
\n
\n
\n            <input type=\"text\"\n                ng-model=\"inputArray[1]\"\n                class=\"form-control\" id=\"{{formName+index}}-1\"/>\n
Last name
\n
\n
\n
",
        popoverTemplate: "<form>\n
\n        Label\n        <input type='text' ng-model=\"label\" validator=\"[required]\" class='form-control'/>\n
\n
\n        \n            <input type='checkbox' ng-model=\"required\" />\n            Required\n        \n
\n\n
\n
\n        <input type='submit' ng-click=\"popover.save($event)\" class='btn btn-primary' value='Save'/>\n        <input type='button' ng-click=\"popover.cancel($event)\" class='btn btn-default' value='Cancel'/>\n        <input type='button' ng-click=\"popover.remove($event)\" class='btn btn-danger' value='Delete'/>\n
\n</form>"
      });
    }
  ]).controller('DemoController', [
    '$scope', '$builder', '$validator', function($scope, $builder, $validator) {
      var checkbox, textbox;
      textbox = $builder.addFormObject('default', {
        id: 'textbox',
        component: 'textInput',
        label: 'Name',
        description: 'Your name',
        placeholder: 'Your name',
        required: true,
        editable: false
      });
      checkbox = $builder.addFormObject('default', {
        id: 'checkbox',
        component: 'checkbox',
        label: 'Pets',
        description: 'Do you have any pets?',
        options: ['Dog', 'Cat']
      });
      $builder.addFormObject('default', {
        component: 'sampleInput'
      });
      $scope.form = $builder.forms['default'];
      $scope.input = [];
      $scope.defaultValue = {};
      $scope.defaultValue[textbox.id] = 'default value';
      $scope.defaultValue[checkbox.id] = [true, true];
      return $scope.submit = function() {
        return $validator.validate($scope, 'default').success(function() {
          return console.log('success');
        }).error(function() {
          return console.log('error');
        });
      };
    }
  ]);

}).call(this);


text:
package de.tum.in.www1.artemis.repository;

import static org.springframework.data.jpa.repository.EntityGraph.EntityGraphType.LOAD;

import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;

import javax.validation.constraints.NotNull;

import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import de.tum.in.www1.artemis.domain.Exercise;
import de.tum.in.www1.artemis.domain.enumeration.ExerciseMode;
import de.tum.in.www1.artemis.web.rest.dto.CourseExerciseStatisticsDTO;
import de.tum.in.www1.artemis.web.rest.errors.EntityNotFoundException;

/**
 * Spring Data JPA repository for the Exercise entity.
 */
@SuppressWarnings("unused")
@Repository
public interface ExerciseRepository extends JpaRepository<Exercise, Long> {

    @Query("""
            SELECT e FROM Exercise e
            LEFT JOIN FETCH e.categories
            WHERE e.course.id = :#{#courseId}
            """)
    Set<Exercise> findByCourseIdWithCategories(@Param("courseId") Long courseId);

    @Query("""
                SELECT e
                FROM Exercise e LEFT JOIN FETCH e.categories WHERE
                e.id IN :exerciseIds
            """)
    Set<Exercise> findByExerciseIdWithCategories(@Param("exerciseIds") Set<Long> exerciseIds);

    @Query("""
            SELECT e FROM Exercise e
            WHERE e.course.id = :#{#courseId}
            	AND e.mode = 'TEAM'
            """)
    Set<Exercise> findAllTeamExercisesByCourseId(@Param("courseId") Long courseId);

    @Query("""
            SELECT e FROM Exercise e
            WHERE e.course.id = :#{#courseId}
            """)
    Set<Exercise> findAllExercisesByCourseId(@Param("courseId") Long courseId);

    @Query("""
            SELECT e FROM Exercise e
            WHERE e.course.testCourse = FALSE
            	AND e.dueDate >= :#{#now}
            ORDER BY e.dueDate ASC
            """)
    Set<Exercise> findAllExercisesWithCurrentOrUpcomingDueDate(@Param("now") ZonedDateTime now);

    @Query("""
            SELECT e FROM Exercise e
            WHERE e.course.testCourse = FALSE
            	AND e.releaseDate >= :#{#now}
            ORDER BY e.dueDate ASC
            """)
    Set<Exercise> findAllExercisesWithCurrentOrUpcomingReleaseDate(@Param("now") ZonedDateTime now);

    @Query("""
            SELECT e FROM Exercise e
            WHERE e.course.testCourse = FALSE
            	AND e.assessmentDueDate >= :#{#now}
            ORDER BY e.dueDate ASC
            """)
    Set<Exercise> findAllExercisesWithCurrentOrUpcomingAssessmentDueDate(@Param("now") ZonedDateTime now);

    /**
     * Select Exercise for Course ID WHERE there does exist an LtiOutcomeUrl for the current user (-> user has started exercise once using LTI)
     * @param courseId the id of the course
     * @param login the login of the corresponding user
     * @return list of exercises
     */
    @Query("""
            SELECT e FROM Exercise e
            WHERE e.course.id = :#{#courseId}
            AND EXISTS (
            	SELECT l FROM LtiOutcomeUrl l
            	WHERE e = l.exercise
            	AND l.user.login = :#{#login})
            """)
    Set<Exercise> findByCourseIdWhereLtiOutcomeUrlExists(@Param("courseId") Long courseId, @Param("login") String login);

    @Query("""
             SELECT DISTINCT c FROM Exercise e JOIN e.categories c
             WHERE e.course.id = :#{#courseId}
            """)
    Set<String> findAllCategoryNames(@Param("courseId") Long courseId);

    @Query("""
             SELECT DISTINCT e FROM Exercise e
             LEFT JOIN FETCH e.studentParticipations
             WHERE e.id = :#{#exerciseId}
            """)
    Optional<Exercise> findByIdWithEagerParticipations(@Param("exerciseId") Long exerciseId);

    @EntityGraph(type = LOAD, attributePaths = { "categories", "teamAssignmentConfig" })
    Optional<Exercise> findWithEagerCategoriesAndTeamAssignmentConfigById(Long exerciseId);

    @Query("""
             SELECT DISTINCT e from Exercise e
             LEFT JOIN FETCH e.exampleSubmissions examplesub
             LEFT JOIN FETCH examplesub.submission exsub
             LEFT JOIN FETCH exsub.results
             WHERE e.id = :#{#exerciseId}
            """)
    Optional<Exercise> findByIdWithEagerExampleSubmissions(@Param("exerciseId") Long exerciseId);

    @Query("""
            SELECT DISTINCT e from Exercise e
            LEFT JOIN FETCH e.exerciseHints
            LEFT JOIN FETCH e.posts
            LEFT JOIN FETCH e.categories
            WHERE e.id = :#{#exerciseId}
                """)
    Optional<Exercise> findByIdWithDetailsForStudent(@Param("exerciseId") Long exerciseId);

    /**
     *
     * @param courseId - course id of the exercises we want to fetch
     * @return all exercise-ids which belong to the course
     */
    @Query("""
            SELECT e.id FROM Exercise e LEFT JOIN e.course c
            WHERE c.id = :courseId
                """)
    Set<Long> findAllIdsByCourseId(@Param("courseId") Long courseId);

    /**
     * calculates the average score and the participation rate of students for each given individual course exercise
     * by using the last result (rated or not)
     * @param exerciseIds - exercise ids to count the statistics for
     * @return Object[] where each index corresponds to the column from the db (0 refers to exerciseId and so on)
     */
    @Query("""
                SELECT
                e.id,
                AVG(r.score),
                Count(Distinct p.student.id),
                (SELECT count(distinct u.id)
                FROM User u
            WHERE
            e.course.studentGroupName member of u.groups
            AND e.course.teachingAssistantGroupName not member of u.groups
            AND (e.course.editorGroupName IS NULL OR  e.course.editorGroupName not member of u.groups)
            AND e.course.instructorGroupName not member of u.groups
            )
            FROM Exercise e JOIN e.studentParticipations p JOIN p.submissions s JOIN s.results r
            WHERE e.id IN :exerciseIds
            AND e.course.studentGroupName member of p.student.groups
            AND e.course.teachingAssistantGroupName not member of p.student.groups
            AND (e.course.editorGroupName IS NULL OR e.course.editorGroupName not member of p.student.groups)
            AND e.course.instructorGroupName not member of p.student.groups
            AND r.score IS NOT NULL AND r.completionDate IS NOT NULL
            AND
                s.id = (
                    SELECT max(s2.id)
                    FROM Submission s2 JOIN s2.results r2
                    WHERE s2.participation.id = s.participation.id
                    AND r2.score IS NOT NULL AND r2.completionDate IS NOT NULL
                    )
                GROUP BY e.id
                """)
    List<Object[]> calculateStatisticsForIndividualCourseExercises(@Param("exerciseIds") List<Long> exerciseIds);

    /**
     * calculates the average score and the participation rate of students for each given individual course exercise
     * by using the last result (rated or not). This query gets the last result from the participation scores table
     *
     * @param exerciseIds - exercise ids to count the statistics for
     * @return Object[] where each index corresponds to the column from the db (0 refers to exerciseId and so on)
     */
    @Query("""
            SELECT
            e.id,
            AVG(sc.lastScore),
            Count(Distinct p.student.id),
            (SELECT count(distinct u.id)
            FROM User u
            WHERE
            e.course.studentGroupName member of u.groups
            AND e.course.teachingAssistantGroupName not member of u.groups
            AND (e.course.editorGroupName IS NULL OR  e.course.editorGroupName not member of u.groups)
            AND e.course.instructorGroupName not member of u.groups
            )

            FROM Exercise e JOIN e.studentParticipations p, StudentScore sc
            WHERE e.id IN :exerciseIds
            AND sc.exercise = e AND sc.user = p.student
            AND e.course.studentGroupName member of p.student.groups
            AND e.course.teachingAssistantGroupName not member of p.student.groups
            AND (e.course.editorGroupName IS NULL OR e.course.editorGroupName not member of p.student.groups)
            AND e.course.instructorGroupName not member of p.student.groups
            GROUP BY e.id
            """)
    List<Object[]> calculateExerciseStatisticsForIndividualCourseUsingParticipationTable(@Param("exerciseIds") List<Long> exerciseIds);

    /**
     * calculates the average score and the participation rate of students for each given team course exercise
     * by using the last result (rated or not)
     *
     * @param exerciseIds - exercise ids to count the statistics for
     * @return Object[] where each index corresponds to the column from the db (0 refers to exerciseId and so on)
     */
    @Query("""
                SELECT
                e.id,
            AVG(r.score),
                Count(Distinct p.team.id),
                (SELECT count(distinct t.id)
                 FROM Team t JOIN t.students st2
                 WHERE st2.id IN (
                 SELECT DISTINCT u.id
                FROM User u
                WHERE
                e.course.studentGroupName member of u.groups
                AND e.course.teachingAssistantGroupName not member of u.groups
                AND (e.course.editorGroupName IS NULL OR  e.course.editorGroupName not member of u.groups)
                AND e.course.instructorGroupName not member of u.groups
             )
            )
            FROM Exercise e JOIN e.studentParticipations p JOIN p.submissions s JOIN s.results r JOIN p.team.students st
            WHERE e.id IN :exerciseIds
            AND r.score IS NOT NULL AND r.completionDate IS NOT NULL
            AND
            st.id IN (
                 SELECT DISTINCT u.id
                FROM User u
                WHERE
                e.course.studentGroupName member of u.groups
                AND e.course.teachingAssistantGroupName not member of u.groups
                AND (e.course.editorGroupName IS NULL OR e.course.editorGroupName not member of u.groups)
                AND e.course.instructorGroupName not member of u.groups
             )
             AND
            s.id = (
                SELECT max(s2.id)
                FROM Submission s2 JOIN s2.results r2
                WHERE s2.participation.id = s.participation.id
                AND r2.score IS NOT NULL AND r2.completionDate IS NOT NULL
                )
            GROUP BY e.id
                """)
    List<Object[]> calculateStatisticsForTeamCourseExercises(@Param("exerciseIds") List<Long> exerciseIds);

    /**
     * calculates the average score and the participation rate of students for each given team course exercise
     * by using the last result (rated or not). This query gets the last result from the participation scores table
     *
     * @param exerciseIds - exercise ids to count the statistics for
     * @return Object[] where each index corresponds to the column from the db (0 refers to exerciseId and so on)
     */
    @Query("""
                SELECT
                e.id,
            AVG(ts.lastScore),
            Count(Distinct p.team.id),
            (SELECT count(distinct t.id)
             FROM Team t JOIN t.students st2
             WHERE st2.id IN (
                 SELECT DISTINCT u.id
                FROM User u
                WHERE
                e.course.studentGroupName member of u.groups
                AND e.course.teachingAssistantGroupName not member of u.groups
                AND (e.course.editorGroupName IS NULL OR  e.course.editorGroupName not member of u.groups)
                AND e.course.instructorGroupName not member of u.groups
             )
            )
            FROM Exercise e JOIN e.studentParticipations p JOIN p.team.students st, TeamScore ts
            WHERE e.id IN :exerciseIds
            AND ts.exercise = e AND ts.team = p.team
            AND
            st.id IN (
                 SELECT DISTINCT u.id
                FROM User u
                WHERE
                e.course.studentGroupName member of u.groups
                AND e.course.teachingAssistantGroupName not member of u.groups
                AND (e.course.editorGroupName IS NULL OR e.course.editorGroupName not member of u.groups)
                AND e.course.instructorGroupName not member of u.groups
             )
            GROUP BY e.id
            """)
    List<Object[]> calculateExerciseStatisticsForTeamCourseExercisesUsingParticipationTable(@Param("exerciseIds") List<Long> exerciseIds);

    @EntityGraph(type = LOAD, attributePaths = { "studentParticipations", "studentParticipations.student", "studentParticipations.submissions" })
    Optional<Exercise> findWithEagerStudentParticipationsStudentAndSubmissionsById(Long exerciseId);

    /**
     * Returns the title of the exercise with the given id
     *
     * @param exerciseId the id of the exercise
     * @return the name/title of the exercise or null if the exercise does not exist
     */
    @Query("""
            SELECT e.title
            FROM Exercise e
            WHERE e.id = :exerciseId
            """)
    String getExerciseTitle(@Param("exerciseId") Long exerciseId);

    /**
     * Fetches the exercises for a course
     *
     * @param courseId the course to get the exercises for
     * @return a set of exercises with categories
     */
    @Query("""
            SELECT DISTINCT e
            FROM Exercise e LEFT JOIN FETCH e.categories
            WHERE e.course.id = :courseId
            """)
    Set<Exercise> getExercisesForCourseManagementOverview(@Param("courseId") Long courseId);

    /**
     * Fetches the exercises for a course with an assessment due date (or due date if without assessment due date) in the future
     *
     * @param courseId the course to get the exercises for
     * @param now the current date time
     * @return a set of exercises
     */
    @Query("""
            SELECT DISTINCT e
            FROM Exercise e
            WHERE e.course.id = :courseId
                AND (e.assessmentDueDate IS NULL OR e.assessmentDueDate > :now)
                AND (e.assessmentDueDate IS NOT NULL OR e.dueDate IS NULL OR e.dueDate > :now)
            """)
    Set<Exercise> getActiveExercisesForCourseManagementOverview(@Param("courseId") Long courseId, @Param("now") ZonedDateTime now);

    /**
     * Fetches the exercises for a course with a passed assessment due date (or due date if without assessment due date)
     *
     * @param courseId the course to get the exercises for
     * @param now the current date time
     * @return a set of exercises
     */
    @Query("""
            SELECT DISTINCT e
            FROM Exercise e
            WHERE e.course.id = :courseId
                AND (e.assessmentDueDate IS NOT NULL AND e.assessmentDueDate < :now
                OR e.assessmentDueDate IS NULL AND e.dueDate IS NOT NULL AND e.dueDate < :now)
            """)
    List<Exercise> getPastExercisesForCourseManagementOverview(@Param("courseId") Long courseId, @Param("now") ZonedDateTime now);

    /**
     * Finds all exercises that should be part of the summary email (e.g. weekly summary)
     * Exercises should have been released, not yet ended, and the release should be in the time frame [daysAgo,now]
     *
     * @param now the current date time
     * @param daysAgo the current date time minus the wanted number of days (the used interval) (e.g. for weeklySummaries -> daysAgo = 7)
     * @return all exercises that should be part of the summary (email)
     */
    @Query("""
            SELECT exercise
            FROM Exercise exercise
            WHERE exercise.releaseDate IS NOT NULL
                AND exercise.releaseDate < :now
                AND exercise.releaseDate > :daysAgo
                AND ((exercise.dueDate IS NOT NULL AND exercise.dueDate > :now)
                    OR exercise.dueDate IS NULL)
            """)
    Set<Exercise> findAllExercisesForSummary(@Param("now") ZonedDateTime now, @Param("daysAgo") ZonedDateTime daysAgo);

    /**
     * Fetches the number of student participations in the given exercise
     *
     * @param exerciseId the id of the exercise to get the amount for
     * @return The number of participations as Long
     */
    @Query("""
            SELECT COUNT(DISTINCT p.student.id)
            FROM Exercise e JOIN e.studentParticipations p
            WHERE e.id = :exerciseId
            """)
    Long getStudentParticipationCountById(@Param("exerciseId") Long exerciseId);

    /**
     * Fetches the number of team participations in the given exercise
     *
     * @param exerciseId the id of the exercise to get the amount for
     * @return The number of participations as Long
     */
    @Query("""
            SELECT COUNT(DISTINCT p.team.id)
            FROM Exercise e JOIN e.studentParticipations p
            WHERE e.id = :exerciseId
            """)
    Long getTeamParticipationCountById(@Param("exerciseId") Long exerciseId);

    /**
     * Fetches exercise ids of exercises of a course
     *
     * @param courseId the id of the course the exercises are part of
     * @return a list of ids of exercises
     */
    @Query("""
            SELECT e.id
            FROM Exercise e
            WHERE e.course.id = :courseId
            """)
    List<Long> getExerciseIdsByCourseId(@Param("courseId") Long courseId);

    @NotNull
    default Exercise findByIdElseThrow(Long exerciseId) throws EntityNotFoundException {
        return findById(exerciseId).orElseThrow(() -> new EntityNotFoundException("Exercise", exerciseId));
    }

    /**
     * Get one exercise by exerciseId with its categories and its team assignment config
     *
     * @param exerciseId the exerciseId of the entity
     * @return the entity
     */
    @NotNull
    default Exercise findByIdWithCategoriesAndTeamAssignmentConfigElseThrow(Long exerciseId) {
        return findWithEagerCategoriesAndTeamAssignmentConfigById(exerciseId).orElseThrow(() -> new EntityNotFoundException("Exercise", exerciseId));
    }

    /**
     * Finds all exercises where the due date is today or in the future
     * (does not return exercises belonging to test courses).
     *
     * @return set of exercises
     */
    default Set<Exercise> findAllExercisesWithCurrentOrUpcomingDueDate() {
        return findAllExercisesWithCurrentOrUpcomingDueDate(ZonedDateTime.now().truncatedTo(ChronoUnit.DAYS));
    }

    /**
     * Find exercise by exerciseId and load participations in this exercise.
     *
     * @param exerciseId the exerciseId of the exercise entity
     * @return the exercise entity
     */
    @NotNull
    default Exercise findByIdWithStudentParticipationsElseThrow(Long exerciseId) {
        return findByIdWithEagerParticipations(exerciseId).orElseThrow(() -> new EntityNotFoundException("Exercise", exerciseId));
    }

    /**
     * Gets the {@link CourseExerciseStatisticsDTO} for each exercise proved in exerciseIds.
     *

     * calculates the average score and the participation rate of students for each given course exercise (team or individual)
     * by using the last result (rated or not)
     *
     * @param exerciseIds              - list of exercise ids (must belong to the same course)
     * @param useParticipantScoreTable use the participant score table instead of going through participation -> submission -> result
     * @return the list of {@link CourseExerciseStatisticsDTO}
     * @throws IllegalArgumentException if exercise is not found in database, exercise is not a course exercise or not all exercises are from the same course
     */
    default List<CourseExerciseStatisticsDTO> calculateExerciseStatistics(List<Long> exerciseIds, boolean useParticipantScoreTable) throws IllegalArgumentException {
        List<Exercise> exercisesFromDb = new ArrayList<>();
        for (Long exerciseId : exerciseIds) {
            Optional<Exercise> exerciseFromDbOptional = this.findById(exerciseId);
            if (exerciseFromDbOptional.isEmpty()) {
                throw new IllegalArgumentException("Exercise not found in database");
            }
            Exercise exerciseFromDb = exerciseFromDbOptional.get();

            if (!exerciseFromDb.isCourseExercise()) {
                throw new IllegalArgumentException("Exercise is not a course exercise");
            }

            exercisesFromDb.add(exerciseFromDb);
        }

        List<Long> uniqueCourseIds = exercisesFromDb.stream().map(exercise -> exercise.getCourseViaExerciseGroupOrCourseMember().getId()).distinct().toList();
        if (uniqueCourseIds.size() > 1) {
            throw new IllegalArgumentException("Not all exercises are from the same course");
        }

        List<CourseExerciseStatisticsDTO> courseExerciseStatisticsDTOs = new ArrayList<>();

        Map<Long, Object[]> exerciseIdToRawStatisticQueryData = this.getRawStatisticQueryData(exercisesFromDb, useParticipantScoreTable);
        exercisesFromDb.forEach((exercise) -> {
            CourseExerciseStatisticsDTO courseExerciseStatisticsDTO = convertRawStatisticQueryDataToDTO(exerciseIdToRawStatisticQueryData, exercise);
            courseExerciseStatisticsDTOs.add(courseExerciseStatisticsDTO);
        });

        return courseExerciseStatisticsDTOs;
    }

    /**
     * Converts the row data from the exercise statistic query into the corresponding DTO
     * @param exerciseIdToRawStatisticQueryData map from exerciseId to query data
     * @param exercise exercise
     * @return converted DTO
     */
    private CourseExerciseStatisticsDTO convertRawStatisticQueryDataToDTO(Map<Long, Object[]> exerciseIdToRawStatisticQueryData, Exercise exercise) {
        CourseExerciseStatisticsDTO courseExerciseStatisticsDTO = new CourseExerciseStatisticsDTO();
        courseExerciseStatisticsDTO.setExerciseId(exercise.getId());
        courseExerciseStatisticsDTO.setExerciseTitle(exercise.getTitle());
        courseExerciseStatisticsDTO.setExerciseMaxPoints(exercise.getMaxPoints());
        courseExerciseStatisticsDTO.setExerciseMode(exercise.getMode().toString());

        if (exerciseIdToRawStatisticQueryData.containsKey(exercise.getId())) {
            Object[] exerciseStatistics = exerciseIdToRawStatisticQueryData.get(exercise.getId());
            courseExerciseStatisticsDTO.setAverageScoreInPercent(exerciseStatistics[1] != null ? ((Number) exerciseStatistics[1]).doubleValue() : 0.0);
            courseExerciseStatisticsDTO.setNoOfParticipatingStudentsOrTeams(exerciseStatistics[2] != null ? ((Number) exerciseStatistics[2]).intValue() : 0);
            int numberOfPossibleParticipants = exerciseStatistics[3] != null ? ((Number) exerciseStatistics[3]).intValue() : 0;

            if (numberOfPossibleParticipants != 0) {
                double participationRate = ((courseExerciseStatisticsDTO.getNoOfParticipatingStudentsOrTeams() * 1.0) / (numberOfPossibleParticipants * 1.0)) * 100.0;
                courseExerciseStatisticsDTO.setParticipationRateInPercent(Math.round(participationRate * 100.0) / 100.0);
            }
            else {
                courseExerciseStatisticsDTO.setParticipationRateInPercent(0.0);
            }

        }
        else {
            courseExerciseStatisticsDTO.setAverageScoreInPercent(0.0);
            courseExerciseStatisticsDTO.setParticipationRateInPercent(0.0);
            courseExerciseStatisticsDTO.setNoOfParticipatingStudentsOrTeams(0);
        }
        return courseExerciseStatisticsDTO;
    }

    /**
     * calculates the average score and the participation rate of students for each given course exercise (team or individual)
     * by using the last result (rated or not)
     *
     * @param exercisesFromDb          exercises to calculate the statistics for
     * @param useParticipantScoreTable use the participant score table instead of going through participation -> submission -> result*
     * @return Map which maps from exercise id to statistic query row data
     */
    private Map<Long, Object[]> getRawStatisticQueryData(List<Exercise> exercisesFromDb, boolean useParticipantScoreTable) {
        List<Exercise> individualExercises = exercisesFromDb.stream().filter(exercise -> exercise.getMode().equals(ExerciseMode.INDIVIDUAL)).toList();
        List<Exercise> teamExercises = exercisesFromDb.stream().filter(exercise -> exercise.getMode().equals(ExerciseMode.TEAM)).toList();

        List<Object[]> statisticForIndividualExercises;
        List<Object[]> statisticTeamExercises;

        if (useParticipantScoreTable) {
            statisticForIndividualExercises = this
                    .calculateExerciseStatisticsForIndividualCourseUsingParticipationTable(individualExercises.stream().map(Exercise::getId).collect(Collectors.toList()));
            statisticTeamExercises = this
                    .calculateExerciseStatisticsForTeamCourseExercisesUsingParticipationTable(teamExercises.stream().map(Exercise::getId).collect(Collectors.toList()));
        }
        else {
            statisticForIndividualExercises = this.calculateStatisticsForIndividualCourseExercises(individualExercises.stream().map(Exercise::getId).collect(Collectors.toList()));
            statisticTeamExercises = this.calculateStatisticsForTeamCourseExercises(teamExercises.stream().map(Exercise::getId).collect(Collectors.toList()));
        }

        List<Object[]> combinedStatistics = new ArrayList<>();
        combinedStatistics.addAll(statisticForIndividualExercises);
        combinedStatistics.addAll(statisticTeamExercises);

        Map<Long, Object[]> exerciseIdToStatistic = new HashMap<>();
        for (Object[] exerciseStatistic : combinedStatistics) {
            exerciseIdToStatistic.put(((Number) exerciseStatistic[0]).longValue(), exerciseStatistic);
        }
        return exerciseIdToStatistic;
    }

    /**
     * Activates or deactivates the possibility for tutors to assess within the correction round
     *
     * @param exercise - the exercise for which we want to toggle if the second correction round is enabled
     * @return the new state of the second correction
     */
    default boolean toggleSecondCorrection(Exercise exercise) {
        exercise.setSecondCorrectionEnabled(!exercise.getSecondCorrectionEnabled());
        return save(exercise).getSecondCorrectionEnabled();
    }
}


text:
import os
import sys
import re
import logging
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.autoreload
from tornado.process import fork_processes, task_id
from tornado.log import app_log
from tornado.options import define, options, parse_command_line

commons = {}
commons['script_location'] = os.path.abspath(os.path.dirname(__file__))

sys.path.insert(0, commons['script_location'])

define("port", default=9000, help="port", type=int)
define("debug", default=False, help="run in debug mode", type=bool)

class RunApp(object):
    def __init__(self, commons):
        self.commons = commons
        self.commons['safe_mode'] = False
        parse_command_line()

    def run(self):
        if options.debug:
            app_log.setLevel(logging.DEBUG)

        if not options.debug:
            fork_processes(None)
        options.port += task_id() or 0

        app_log.debug("Starting %s on port %s" % ('tornado skeleton', options.port))
        # initialize the application
        tornado.httpserver.HTTPServer(Application(self.commons)).listen(options.port, '0.0.0.0')
        ioloop = tornado.ioloop.IOLoop.instance()
        if options.debug:
            tornado.autoreload.start(ioloop)
        # enter the Tornado IO loop
        ioloop.start()

class Application(tornado.web.Application):
    def __init__(self, commons):
        self.commons = commons
        app_log.debug("Application path (%s)" % (self.commons['script_location'],))

        urls = [
            (r"/(.*)", tornado.web.StaticFileHandler,
             {"path" : os.path.join(self.commons['script_location'],
                                    'app',
                                    'index.html')}),
            (r"/partials/(.*)", tornado.web.StaticFileHandler,
             {"path" : os.path.join(self.commons['script_location'],
                                    'app',
                                    'partials')}),

        ]

        settings = dict(
            template_path=None,
            static_path=os.path.join(self.commons['script_location'],
                                     'app'),
            xsrf_cookies=False if options.debug else True,
            cookie_secret='i love my dog!',
            debug=options.debug,
            )
        tornado.web.Application.__init__(self, urls, **settings)

if __name__=="__main__":
    sys.exit(RunApp(commons).run())


text:
$(document).ready(function() {
    var
        $gallery = $(".gallery"),
    	$galleryPictures = $(".gallery-pictures"),
        $galleryPicture = $(".gallery-picture"),
        lastPos = {x:0},
        galleryPos = {x:0},
        currentImage = -1,
        imageWidth = 700,
        imageSpacing = 120,
        imageTotalWidth=imageWidth+imageSpacing,
        speedLog=[],
        speedLogLimit=5,
        minBlur=2,
        maxBlur=200,
        blurMultiplier=0.25,
        lastBlur=0,
        dragging=false,
        lastDragPos={x:0},
        dragPos={x:0},
        totalDist=0,
        distThreshold=10,
        distLog=[],
        distLogLimit=10,
        momentumTween=null
    ;

	function setBlur(v){
		if(v<minBlur) v=0;
		if(v>maxBlur) v=maxBlur;
		if(v!=lastBlur){
			$("#blur").get(0).firstElementChild.setAttribute("stdDeviation",v+",0");
		}
		lastBlur=v;
	}

	$galleryPictures.css({
		webkitFilter:"url('#blur')",
		filter:"url('#blur')"
	});
    $galleryPicture.each(function(i) {
        var cur = $(this);
  		cur.click(function(){
  			if(Math.abs(totalDist)<distThreshold)
  				setGalleryPos(i);
  		});
  		$(".gallery-pagination-dot").eq(i).click(function(){
  			setGalleryPos(i);
  		})
    });

    function setGalleryPos(v,anim){
    	if(typeof anim=="undefined") anim=true;
    	stopMomentum();
    	TweenMax.to(galleryPos,anim?0.8:0,{
    		x:-v*imageTotalWidth,
    		ease:Quint.easeOut,
    		onUpdate:updateGalleryPos,
    		onComplete:updateGalleryPos
    	});
    }

    function updateGalleryPos(){
    	TweenMax.set($galleryPictures,{
    		x:galleryPos.x+(($(window).width()-imageWidth)/2),
    		force3D:true,
    		lazy:true
    	});
    	var speed=lastPos.x-galleryPos.x;
    	var blur=Math.abs(Math.round(speed*blurMultiplier));
	    setBlur(blur);
    	lastPos.x=galleryPos.x;

	    var _currentImage=Math.round(-galleryPos.x/imageTotalWidth);
	    if(_currentImage!=currentImage){
	    	currentImage=_currentImage;
	    	$(".gallery-pagination-dot-selected").removeClass('gallery-pagination-dot-selected');
	    	$(".gallery-pagination-dot").eq(currentImage).addClass('gallery-pagination-dot-selected')
	    }

    }
    $gallery.mousedown(function(event){
    	event.preventDefault();
    	dragging=true;
    	dragPos.x=event.pageX;
    	lastDragPos.x=dragPos.x;
    	totalDist=0;
    	distLog=[];

    	stopMomentum();

    	updateGalleryPosLoop();
    });
    $(document).mousemove(function(event){
    	if(dragging){
    		dragPos.x=event.pageX;
    	}
    });
    function updateGalleryPosLoop(){
    	if(dragging){
    		updateGalleryPos();
    		var dist=dragPos.x-lastDragPos.x;
    		lastDragPos.x=dragPos.x;
    		totalDist+=dist;
    		distLog.push(dist);
    		while(distLog.length>distLogLimit){
    			distLog.splice(0,1);
    		};
    		galleryPos.x+=dist;
    		requestAnimationFrame(updateGalleryPosLoop)
    	}
    }
    $(document).mouseup(function(event){
    	if(dragging){
	    	dragging=false;
	    	var releaseSpeed=0;
	    	for (var i = 0; i < distLog.length; i++) {
	    		releaseSpeed+=distLog[i];
	    	};
	    	releaseSpeed/=distLog.length;

	    	var targetX=galleryPos.x+(releaseSpeed*20);
	    	targetX=Math.round(targetX/imageTotalWidth)*imageTotalWidth;
	    	var targetImage=-targetX/imageTotalWidth;
	    	var excess=0;
	    	if(targetImage<0){
	    		excess=targetImage;
	    		targetImage=0;
	    	}else if(targetImage>=$galleryPicture.length){
	    		excess=targetImage-($galleryPicture.length-1);
	    		targetImage=$galleryPicture.length-1;
	    	}
	    	if(excess!=0){
	    		targetX=-targetImage*imageTotalWidth;
	    	}
	    	momentumTween=TweenMax.to(galleryPos,1-(Math.abs(excess)/20),{
	    		x:targetX,
	    		ease:Quint.easeOut,
	    		onUpdate:updateGalleryPos,
	    		onComplete:updateGalleryPos
	    	});

	    	if(Math.abs(totalDist)>=distThreshold){
	    		event.preventDefault();
	    		event.stopPropagation();
	    	}
	    }
    });
    function stopMomentum(){
    	if(momentumTween!=null){
	    	momentumTween.kill();
	    	momentumTween=null;
	    	updateGalleryPos();
	    }
    }

    setGalleryPos(0,false);
})


text:
require 'appraisal'
require 'appraisal/command'
module Kernal
  module Captures
    def capture_output
      buffer = []
      real_stdout, $stdout = $stdout, StringIO.new
      buffer << yield
      buffer << $stdout.string
      return buffer.join
    ensure
      $stdout = real_stdout
    end

    def capture_all_output
      capture_output do
        capture_warning do
          yield
        end
      end
    end

    def capture_warning
      buffer = []
      real_stderr, $stderr = $stderr, StringIO.new
      buffer << yield
      buffer << $stderr.string
      return buffer.join
    ensure
      $stderr = real_stderr
    end
  end
end

include Kernal::Captures

module CompassRails
  module Test
    module CommandHelper
      include DebugHelper
      GEMFILES_DIR = Pathname.new(ROOT_PATH).join('gemfiles')
      BUNDLER_COMMAND = 'bundle'

      def run_command(command, gemfile=nil)
        debug(Rainbow("Running: #{command} with gemfile: #{gemfile}").foreground(:cyan))
        capture_all_output { CompassRails::Test::CommandRunner.new(command, gemfile).run }
      end

      def bundle(gemfile=nil)
        run_command(BUNDLER_COMMAND, gemfile)
      end

    end
  end
end

# Executes commands with a clean environment
class CompassRails::Test::CommandRunner
  BUNDLER_ENV_VARS = %w(RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE).freeze

  def self.from_args(gemfile)
    command = ([$0] + ARGV.slice(1, ARGV.size)).join(' ')
    new(command, gemfile)
  end

  def initialize(command, gemfile = nil)
    @original_env = {}
    @gemfile = gemfile
    if command =~ /^bundle/
      @command = command
    else
      @command = "bundle exec #{command}"
    end
  end

  def run
    announce
    with_clean_env do
      %x{#{@command}}
    end
  end

  def exec
    announce
    with_clean_env { Kernel.exec(@command) }
  end

  private

  def with_clean_env
    unset_bundler_env_vars
    ENV['BUNDLE_GEMFILE'] = @gemfile
    yield
  ensure
    restore_env
  end

  def announce
    return
    if @gemfile
      puts ">> BUNDLE_GEMFILE=#{@gemfile} #{@command}"
    else
      puts ">> #{@command}"
    end
  end

  def unset_bundler_env_vars
    BUNDLER_ENV_VARS.each do |key|
      @original_env[key] = ENV[key]
      ENV[key] = nil
    end
  end

  def restore_env
    @original_env.each { |key, value| ENV[key] = value }
  end
end


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Using as: Symbol Type</title>

<meta name="description" content="Using as: Symbol Type">
<meta name="keywords" content="Using as: Symbol Type">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Symbol-Attributes.html#Symbol-Attributes" rel="up" title="Symbol Attributes">
<link href="a_002eout-Symbols.html#a_002eout-Symbols" rel="next" title="a.out Symbols">
<link href="Symbol-Value.html#Symbol-Value" rel="prev" title="Symbol Value">

Next: a.out Symbols, Previous: Symbol Value, Up: Symbol Attributes   [Contents][Index]

5.5.2 Type

The type attribute of a symbol contains relocation (section)
information, any flag settings indicating that a symbol is external, and
(optionally), other information for linkers and debuggers.  The exact
format depends on the object-code output format in use.


text:
{% for category,subcategories in categories %}

                {% if subcategories %}

                {% endif %}

                   {{ category.name }}

        {% if subcategories %}

            {% with filename="fancypages/dashboard/partials/page_select_link.html" %}
            {% include filename with categories=subcategories %}
            {% endwith %}

        {% endif %}

{% endfor %}


text:
<html>
<body>

A UIType is a Java type that may result from direct input from a UI framework.
For HTML, these types are Boolean, String and String[].
</body>
</html>


text:
Display::Application.routes.draw do

  devise_for :users, :controllers => {:registrations => 'registrations', :sessions => 'sessions', :confirmations => 'confirmations', :passwords => 'passwords'}, :defaults => { :org_name => nil }

  devise_scope(:user) do
    get    'registrations/lookup', :to => 'registrations#lookup',  :as => 'user_lookup', :defaults => { :org_name => nil }
    delete 'registration/:id',     :to => 'registrations#destroy', :as => 'delete_user', :defaults => { :org_name => nil }
  end

  match '*x', :via => 'OPTIONS', :to => 'application#cors_options'

  get '/status/ecv' => 'status#ecv'

  get '/error' => 'welcome#error', :as => :error_redirect

  get 'users/:id' => 'organization/users#show', :as => 'user'
  match '/auth/:provider/callback' => 'authentications#create', :via => [:get, :post]

  get 'r/ns'                                => 'redirect#ns',          :as => 'redirect_ns'
  get 'r/ci/:id'                            => 'redirect#ci',          :as => 'redirect_ci'
  get 'r/release/:id'                       => 'redirect#release'
  get 'r/r/:id'                             => 'redirect#release',     :as => 'redirect_release'
  get 'r/deployment/:id'                    => 'redirect#deployment'
  get 'r/d/:id'                             => 'redirect#deployment',  :as => 'redirect_deployment'
  get 'r/procedure/:id'                     => 'redirect#procedure'
  get 'r/p/:id'                             => 'redirect#procedure',   :as => 'redirect_procedure'
  get 'r/instances/:id'                     => 'redirect#instance'
  get 'r/i/:id'                             => 'redirect#instance',    :as => 'redirect_instance'
  get 'r/instances/:id/monitors/:monitor/d' => 'redirect#monitor_doc', :as => 'redirect_instance_monitor_doc'

  get 'l/ci/:id'         => 'lookup#ci',         :as => 'lookup_ci'
  get 'l/release/:id'    => 'lookup#release'
  get 'l/r/:id'          => 'lookup#release',    :as => 'lookup_release'
  get 'l/deployment/:id' => 'lookup#deployment'
  get 'l/d/:id'          => 'lookup#deployment', :as => 'lookup_deployment'
  get 'l/procedure/:id'  => 'lookup#procedure'
  get 'l/p/:id'          => 'lookup#procedure',  :as => 'lookup_procedure'

  get '/api_docs' => 'welcome#api_docs'

  resource :support, :controller => 'support', :only => [:show], :defaults => { :org_name => nil } do
    collection do
      get  'announcements'
      put  'announcements'
      get  'compute_report'
      get  'compute'
      post 'compute'
      get  'search'
      get  'organizations'
      get  'users'
      get  'user'

      get 'organization/:name', :action => 'organization', :as => 'organization'
      # delete 'organization/:name', :action => 'organization'
    end
  end

  resource :metadata, :controller => 'metadata', :only => [:show] do
    collection do
      get 'lookup_class_name'
      get 'lookup_attr_name'
    end
  end

  resource :watch, :controller => 'watch', :only => [:show, :create, :destroy]

  post '/:org_name/request_access' => 'organization#request_access', :as => 'organization_request_access'
  get '/:org_name' => 'organization#public_profile', :as => 'organization_public_profile'

  resource :organization, :controller => 'organization', :only => :none do
    get 'announcement', :on => :collection
    put 'announcement', :on => :collection
    get 'lookup',       :on => :collection
  end

  namespace :account, :defaults => { :org_name => nil } do
    resource :profile, :controller => 'profile', :only => [:show, :update] do
      member do
        put  'change_password'
        put  'hide_wizard'
        put  'change_organization'
        put  'reset_authentication_token'
        get  'show_eula'
        put  'accept_eula'
        post 'authentication_token'
        get  'organizations'
        put  'session_preferences'
      end
    end

    resources :favorites, :controller => 'favorites', :only => [:index, :show, :destroy]

    resources :organizations, :only => [:index, :show, :new, :create, :destroy] do
      get    'current_organization', :on => :collection
      delete 'leave', :on => :member
    end

    resources :groups do
      get 'confirm_delete', :on => :member
      get 'lookup', :on => :collection

      resources :members, :controller => 'group_members', :as => 'members', :only => [:index, :show, :create, :update, :destroy]
    end
  end

  # TODO: move under account
  resources :authentications, :only => [:create, :destroy]

  scope '/:org_name' do
    resource :organization, :controller => 'organization', :only => [:show, :edit, :update] do
      member do
        get 'notifications'
        get 'deployments'
        get 'procedures'
        get 'reports'
        get 'health'
        get 'search'
        get 'cost_rate'
        get 'cost'
      end

      resources :users, :controller => 'organization/users'

      resources :teams, :controller => 'organization/teams' do
        resources :members, :controller => 'organization/team_members', :as => :members, :only => [:index, :create, :destroy]
      end

      resources :environments, :controller => 'organization/environments'
      resources :policies, :controller => 'organization/policies' do
        get 'evaluate', :on => :collection
        get 'evaluate', :on => :member
      end
    end

    resources :notifications

    resource :watch, :controller => 'watch', :only => [:create, :destroy]
    resources :favorites, :controller => 'account/favorites', :only => [:show, :create, :destroy]

    resource :lookup, :controller => 'lookup', :only => :none do
      get 'counterparts', :on => :collection
    end

    resource :ci, :controller => 'lookup', :only => :none do
      post 'policy_violations', :on => :collection
    end

    #Provider services
    resources :services, :controller => 'services/services' do
      get :available, :on => :collection
    end

    resources :clouds, :controller => 'cloud/clouds' do
      get :locations,  :on => :collection
      member do
        get :operations
        get :instances
        get :procedures
        get :reports
        get :search
        get :teams
        put :update_teams
      end

      resources :services, :controller => 'cloud/services' do
        get :available, :on => :collection
        get :diff, :on => :collection

        resources :offerings, :controller => 'cloud/offerings' do
          get 'available', :on => :collection
        end
      end

      resources :compliances, :controller => 'cloud/compliances' do
        get :available, :on => :collection
      end

      resources :supports, :controller => 'cloud/supports'

      resources :variables, :controller => 'cloud/variables'
    end

    resources :reports, :only => :none do
      get  'compute',      :on => :collection
      post 'compute',      :on => :collection
      get  'health',       :on => :collection
      get  'notification', :on => :collection
      get  'cost',         :on => :collection
    end

    resources :packs, :only => [:index]

    # Design catalogs.
    resources :catalogs, :controller => 'catalog/catalogs', :only => [:index, :show, :destroy] do
      get  'export',  :on => :member
      post 'import',  :on => :collection
      get  'diagram', :on => :member

      resources :platforms, :controller => 'catalog/platforms', :only => [:index, :show] do
        get 'diagram', :on => :member
        resources :components, :controller => 'catalog/components', :only => [:index, :edit]
      end
    end

    resources :deployments, :controller => 'transition/deployments', :only => :none do
      get 'time_stats', :on => :member
    end

    resources :assemblies do
      member do
        get  'new_clone'
        post 'clone'
        get  'teams'
        put  'update_teams'
        get  'notifications'
        get  'reports'
        get  'search'
        get  'cost_rate'
        get  'cost'
      end

      resources :instances, :controller => 'operations/instances', :only => [:index]

      # Design.
      resource :design, :controller => 'design', :only => [:show] do
        get  'extract', :on => :member
        get  'load',    :on => :member
        put  'load',    :on => :member
        get  'diagram', :on => :member
      end

      namespace :design do
        resources :variables do
          put 'lock',   :on => :collection
          put 'unlock', :on => :collection
        end

        resources :platforms do
          get  'new_clone',       :on => :member
          post 'clone',           :on => :member
          get  'diagram',         :on => :member
          get  'component_types', :on => :member
          get  'diff',            :on => :member

          resources :variables, :controller => 'local_variables' do
            put 'lock',   :on => :collection
            put 'unlock', :on => :collection
          end

          resources :components do
            get 'history', :on => :member
            put 'update_services', :on => :member

            resources :attachments
          end

          resources :attachments, :only => [:show, :edit, :update, :destroy]
        end

        resources :releases, :only => [:edit, :show, :index] do
          get  'latest',  :on => :collection
          post 'commit',  :on => :member
          post 'discard', :on => :member
        end
      end

      # Transition.
      resource :transition, :controller => 'transition', :only => [:show]

      namespace :transition do
        resources :environments do
          post 'pull',         :on => :member
          post 'commit',       :on => :member
          post 'force_deploy', :on => :member
          post 'discard',      :on => :member
          put  'enable',       :on => :member
          put  'disable',      :on => :member
          get  'diagram',      :on => :member
          get  'search',       :on => :member

          resources :variables, :only => [:index, :show, :edit, :update] do
            put 'lock',   :on => :collection
            put 'unlock', :on => :collection
          end

          resources :relays do
            put 'toggle', :on => :member
          end

          resources :platforms, :only => [:index, :show, :edit, :update, :destroy] do
            get 'toggle',              :on => :member
            get 'activate',            :on => :member
            get 'diagram',             :on => :member
            put 'cloud_configuration', :on => :member
            put 'cloud_priority',      :on => :member

            resources :components, :only => [:index, :show, :edit, :update] do
              get  'history',         :on => :member
              put  'update_services', :on => :member
              post 'touch',           :on => :member
              post 'touch',           :on => :collection
              post 'deploy',          :on => :member

              resources :attachments, :only => [:index, :show, :edit, :update]

              resources :monitors do
                get 'watched_by',        :on => :member
                put 'update_watched_by', :on => :member
                put 'toggle',            :on => :member
              end

              resources :logs
            end

            resources :variables, :controller => 'local_variables', :only => [:index, :show, :edit, :update] do
              put 'lock',   :on => :collection
              put 'unlock', :on => :collection
            end

            resources :attachments, :only => [:show, :edit, :update]

            resources :monitors, :only => [:show, :edit, :update]
          end

          resources :releases, :only => [:show, :edit, :index] do
            get  'latest',  :on => :collection
            get  'bom',     :on => :collection
            get  'diagram', :on => :member
            post 'discard', :on => :member
          end

          resources :deployments, :only => [:new, :create, :edit, :update, :show, :index] do
            get 'latest',         :on => :collection
            get 'status',         :on => :member
            post 'status',        :on => :member
            get 'compile_status', :on => :collection
            get 'log_data',       :on => :member

            resources :approvals, :only => [:index] do
              put 'settle', :on => :collection
            end
          end
        end
      end

      # Operations
      resource :operations, :controller => 'operations', :only => [:show]

      namespace :operations do
        resources :environments, :only => [:index, :show] do
          resources :platforms, :only => [:index, :show] do
            resources :components, :only => [:index, :show] do
              get  'actions', :on => :member
              get  'charts',  :on => :member
              post 'charts',  :on => :member

              resources :instances, :only => [:index, :show, :destroy] do
                put 'cancel_deployment', :on => :member
                get 'availability',      :on => :member
                get 'notifications',     :on => :member
                get 'logs',              :on => :member
                put 'state',             :on => :member

                resources :monitors, :only => [:index, :show] do
                  get 'charts', :on => :collection
                end
              end
            end

            # Allow routing to instances without nesting under component.
            resources :instances, :only => [:show, :destroy] do
              put 'cancel_deployment', :on => :member
              get 'availability',      :on => :member
              get 'notifications',     :on => :member
              get 'logs',              :on => :member
              put 'state',             :on => :member

              resources :monitors, :only => [:index, :show] do
                get 'charts', :on => :collection
              end
            end

            get 'procedures',  :on => :member
            get 'graph',       :on => :member
            put 'autorepair',  :on => :member
            get 'autoreplace', :on => :member
            put 'autoreplace', :on => :member
            put 'autoscale',   :on => :member
          end

          resources :instances, :only => [:index]

          get 'graph',         :on => :member
          get 'notifications', :on => :member
          get 'search',        :on => :member
          get 'cost',          :on => :member
          get 'cost_rate',     :on => :member
        end

        resources :instances, :only => :none do
          put 'state', :on => :member
          put 'state', :on => :collection
        end
      end
    end

    namespace :transition do
      resources :deployments, :only => [:index]
    end

    namespace :operations do
      resources :platforms, :only => :none do
        get 'diagram', :on => :member
      end

      resources :instances, :only => :none do
        put 'state', :on => :collection
      end

      resources :procedures, :except => [:destroy] do
        get  'status',   :on => :member
        post 'status',   :on => :member
        get  'log_data', :on => :collection
        post 'prepare',  :on => :collection
      end
    end

    resource :operations, :controller => 'operations', :only => :none do
      get  'health', :on => :collection
      post 'charts', :on => :collection
    end

    match '*whatever' => 'welcome#not_found_error', :via => :all
  end

  post 'notify' => 'relays#notify'

  match 'error' => 'welcome#error', :via => :all
  get '/404'  => 'welcome#not_found_error', :as => 'not_found'
  get '/500'  => 'welcome#server_error'

  root :to => 'welcome#index', :defaults => {:org_name => nil}, :as => :root

  # The priority is based upon order of creation:
  # first created -> highest priority.

  # Sample of regular route:
  #   match 'products/:id' => 'catalog#view'
  # Keep in mind you can assign values other than :controller and :action

  # Sample of named route:
  #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Sample resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Sample resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Sample resource route with more complex sub-resources
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', :on => :collection
  #     end
  #   end

  # Sample resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end

  # You can have the root of your site routed with "root"
  # just remember to delete public/index.html.
  # root :to => "welcome#index"

  # See how all your routes lay out with "rake routes"

  # This is a legacy wild controller route that's not recommended for RESTful applications.
  # Note: This route will make all actions in every controller accessible via GET requests.
  # match ':controller(/:action(/:id(.:format)))'
end


text:
/**
 *类名称:疑点任务负责人
 *公司: 吉贝克信息技术(北京)有限公司
 *文件名:DouTaskChargeService.java
 *作者:
 *创建时间: 2013-11-21 18:55
 *最后更新: 2013-11-21 18:55
 *
 *1.作者:  2013-11-21 18:55
 *初始版本
 *本类提供以下方法:
 *
 **(如要修改,请注释 修改人、修改时间、修改说明)
 *
 */

package  com.gbicc.bll.doubt.service.impl;

import java.util.List;

import com.gbicc.bll.doubt.bean.DouTaskCharge;

import com.gbicc.bll.PaginateInfo;
import com.gbicc.bll.doubt.bean.DouTaskCharge;

import com.gbicc.bll.doubt.dao.DouTaskChargeDAO;
import com.gbicc.bll.doubt.service.DouTaskChargeService;

public class DouTaskChargeServiceImpl implements DouTaskChargeService {

		private DouTaskChargeDAO douTaskChargeDAO;

		/**
		 * 查询
		 */
		public List getDouTaskChargeList(DouTaskCharge doutaskcharge){
			return this.douTaskChargeDAO.getDouTaskChargeList(doutaskcharge);
		}

		@Override
		public int queryCount(DouTaskCharge doutaskcharge) {
			// TODO Auto-generated method stub
			return this.douTaskChargeDAO.queryCount(doutaskcharge);
		}
		@Override
		public List queryData(DouTaskCharge doutaskcharge,PaginateInfo paginateInfo){
			return this.douTaskChargeDAO.queryData(doutaskcharge,paginateInfo);
		}

		/**
		 * 通过编号查询
		 */
		public DouTaskCharge getDouTaskChargeById(String id){
			return this.douTaskChargeDAO.getDouTaskChargeById(id);
		}

		/**
		 *  插入
		 * @param doutaskcharge
		 * @return
		 */
		public String insertDouTaskCharge(DouTaskCharge doutaskcharge){
			return this.douTaskChargeDAO.insertDouTaskCharge(doutaskcharge);
		}

		/**
		 * 修改
		 * @param doutaskcharge
		 */
		public int updateDouTaskCharge(DouTaskCharge doutaskcharge){
			return this.douTaskChargeDAO.updateDouTaskCharge(doutaskcharge);
		}

		/**
		 * 删除
		 * @param id:编号
		 */
		public int deleteDouTaskCharge(String id){
			return this.douTaskChargeDAO.deleteDouTaskCharge(id);
		}

		/**
		 * set dao
		 * @param douTaskChargeDAO
		 */
		public void setDouTaskChargeDAO(DouTaskChargeDAO douTaskChargeDAO) {
			this.douTaskChargeDAO = douTaskChargeDAO;
		}

	//end auto create.
}


text:
@implementation OCServerFeatures

- (id)initWithSupportForShare:(BOOL)share sharee:(BOOL)sharee cookies:(BOOL)cookies forbiddenCharacters:(BOOL)forbiddenCharacters capabilities:(BOOL)capabilites fedSharesOptionShare:(BOOL)fedSharesOptionShare publicShareLinkOptionName:(BOOL)publicShareLinkOptionName publicShareLinkOptionUploadOnlySupport:(BOOL)publicShareLinkOptionUploadOnlySupport {

    self = [super init];
    if (self) {
        // Custom initialization
        _hasShareSupport = share;
        _hasShareeSupport = sharee;
        _hasCookiesSupport = cookies;
        _hasForbiddenCharactersSupport = forbiddenCharacters;
        _hasCapabilitiesSupport = capabilites;
        _hasFedSharesOptionShareSupport = fedSharesOptionShare;
        _hasPublicShareLinkOptionNameSupport = publicShareLinkOptionName;
        _hasPublicShareLinkOptionUploadOnlySupport = publicShareLinkOptionUploadOnlySupport;

    }

    return self;
}

- (BOOL)isEqual:(id)other {
    if (other == self)
        return YES;
    if (!other || ![other isKindOfClass:[self class]])
        return NO;
    OCServerFeatures *castedOther = (OCServerFeatures *)other;
    return (castedOther.hasShareSupport == self.hasShareSupport &&
            castedOther.hasShareeSupport == self.hasShareeSupport &&
            castedOther.hasCookiesSupport == self.hasCookiesSupport &&
            castedOther.hasForbiddenCharactersSupport == self.hasForbiddenCharactersSupport &&
            castedOther.hasCapabilitiesSupport == self.hasCapabilitiesSupport &&
            castedOther.hasFedSharesOptionShareSupport == self.hasFedSharesOptionShareSupport &&
            castedOther.hasPublicShareLinkOptionNameSupport == self.hasPublicShareLinkOptionNameSupport &&
            castedOther.hasPublicShareLinkOptionUploadOnlySupport == self.hasPublicShareLinkOptionUploadOnlySupport
            );

}

@end


text:
// Type definitions for webpack-node-externals 1.6
// Project: https://github.com/liady/webpack-node-externals
// Definitions by: Matt Traynham <https://github.com/mtraynham>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

import webpack = require('webpack');

export = webpackNodeExternals;

declare function webpackNodeExternals(options?: webpackNodeExternals.Options): webpack.ExternalsFunctionElement;

declare namespace webpackNodeExternals {
    type WhitelistOption = string | RegExp;

    interface Options {
        /**
         * An array for the externals to whitelist, so they will be included in the bundle.
         * Can accept exact strings ('module_name'), regex patterns (/^module_name/), or a
         * function that accepts the module name and returns whether it should be included.
         * Important - if you have set aliases in your webpack config with the exact
         * same names as modules in node_modules, you need to whitelist them so Webpack will know
         * they should be bundled.
         * @default []
         */
        whitelist?: WhitelistOption[];
        /**
         * @default ['.bin']
         */
        binaryDirs?: string[];
        /**
         * The method in which unbundled modules will be required in the code. Best to leave as
         * 'commonjs' for node modules.
         * @default 'commonjs'
         */
        importType?: 'var' | 'this' | 'commonjs' | 'amd' | 'umd';
        /**
         * The folder in which to search for the node modules.
         * @default 'node_modules'
         */
        modulesDir?: string;
        /**
         * Read the modules from the package.json file instead of the node_modules folder.
         * @default false
         */
        modulesFromFile?: boolean;
        /**
         * @default false
         */
        includeAbsolutePaths?: boolean;
    }
}


text:
package mysqlctl

import (
	// Register the gRPC mysqlctl client.
	_ "vitess.io/vitess/go/vt/mysqlctl/grpcmysqlctlclient"
)


text:
package org.artifactory.common.wicket.component.panel.titled;

import org.apache.wicket.Component;

/**
 * @author Tomer Cohen
 */
public class TitledPanelDecorator extends TitledPanel {
    public static final String CHILD_ID = "child";

    public TitledPanelDecorator(String id, Component child) {
        super(id);
        add(child);
    }

    @Override
    public String getTitle() {
        return getString(getId(), null);
    }
}


text:
apt-get update
apt-get install -y build-essential valgrind