text:
namespace simpleCNN {

  template <typename T, std::size_t alignment>
  class aligned_allocator {
   public:
    typedef T value_type;
    typedef T* pointer;
    typedef std::size_t size_type;
    typedef std::ptrdiff_t difference_type;
    typedef T& reference;
    typedef const T& const_reference;
    typedef const T* const_pointer;

    template <typename U>
    struct rebind {
      typedef aligned_allocator<U, alignment> other;
    };

    aligned_allocator() {}

    template <typename U>
    aligned_allocator(const aligned_allocator<U, alignment>&) {}

    const_pointer address(const_reference value) const { return std::addressof(value); }

    pointer address(reference value) const { return std::addressof(value); }

    pointer allocate(size_type size, const void* = nullptr) {
      void* p = aligned_alloc(alignment, sizeof(T) * size);
      if (!p && size > 0) throw simple_error("failed to allocate");
      return static_cast<pointer>(p);
    }

    size_type max_size() const { return ~static_cast<std::size_t>(0) / sizeof(T); }

    void deallocate(pointer ptr, size_type) { aligned_free(ptr); }

    template <class U, class V>
    void construct(U* ptr, const V& value) {
      void* p = ptr;
      ::new (p) U(value);
    }

    template <class U, class... Args>
    void construct(U* ptr, Args&&... args) {
      void* p = ptr;
      ::new (p) U(std::forward<Args>(args)...);
    }

    template <class U>
    void construct(U* ptr) {
      void* p = ptr;
      ::new (p) U();
    }

    template <class U>
    void destroy(U* ptr) {
      ptr->~U();
    }

   private:
    void* aligned_alloc(size_type align, size_type size) const {
      void* p;
      if (::posix_memalign(&p, align, size) != 0) {
        p = 0;
      }
      return p;
    }

    void aligned_free(pointer ptr) { ::free(ptr); }
  };

  template <typename T1, typename T2, std::size_t alignment>
  inline bool operator==(const aligned_allocator<T1, alignment>&, const aligned_allocator<T2, alignment>&) {
    return true;
  }

  template <typename T1, typename T2, std::size_t alignment>
  inline bool operator!=(const aligned_allocator<T1, alignment>&, const aligned_allocator<T2, alignment>&) {
    return false;
  }
}  // namespace simpleCNN


text:
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using DotVVM.Framework.Hosting;
using DotVVM.Framework.Runtime.Filters;
using DotVVM.Framework.ViewModel;

namespace DotVVM.Samples.Common.ViewModels.FeatureSamples.ActionFilterErrorHandling
{
    [ActionFilterRedirectExceptionFilter]
    public class ActionFilterRedirectViewModel : DotvvmViewModelBase
    {
        private bool throwOnPreRender;

        public void TestCommandException()
        {
            throw new Exception("Exception");
        }

        public void TestPageException()
        {
            throwOnPreRender = true;
        }

        public override Task PreRender()
        {
            if (throwOnPreRender)
            {
                throw new Exception("Exception");
            }

            return base.PreRender();
        }

    }

    public class ActionFilterRedirectExceptionFilterAttribute : ExceptionFilterAttribute
    {
        protected override Task OnCommandExceptionAsync(IDotvvmRequestContext context, ActionInfo actionInfo, Exception exception)
        {
            if (!context.HttpContext.Request.Query.ContainsKey("redirected"))
            {
                context.RedirectToUrl(context.HttpContext.Request.Url.AbsoluteUri + "?redirected=true");
            }

            return base.OnPageExceptionAsync(context, exception);
        }

        protected override Task OnPageExceptionAsync(IDotvvmRequestContext context, Exception exception)
        {
            if (!context.HttpContext.Request.Query.ContainsKey("redirected"))
            {
                context.RedirectToUrl(context.HttpContext.Request.Url.AbsoluteUri + "?redirected=true");
            }

            return base.OnPageExceptionAsync(context, exception);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.kuali.continuity.admin.dao;

import java.util.List;

import org.kuali.continuity.PlanTestData;
import org.kuali.continuity.admin.domain.CriticalFunctionExample;

public class CriticalFunctionExampleDAOTest extends AdminDAOTest {

	private GenericAdminDAOFactory factory;
	private GenericAdminDAO<CriticalFunctionExample> dao;

	@SuppressWarnings("unchecked")
	public void setFactory(GenericAdminDAOFactory factory) {
		this.factory = factory;
		this.dao = (GenericAdminDAO<CriticalFunctionExample>)
			factory.getGenericAdminDAO(CriticalFunctionExample.class);
	}

	public void testInjection() throws Exception {
		System.out.println("DAO is " + this.factory.getClass().getName());
	}

	public void testGetListSize() throws Exception {
		long size = this.dao.getListBySystemDomainIdSize(PlanTestData.wellknown_institution);
		assertTrue(size > 0L);
	}

	public void testGetList() throws Exception {
		this.doTestList(this.dao.getListBySystemDomainId(PlanTestData.wellknown_institution));
	}

	public void testCRUD() throws Exception {
		this.doTestCreate();
		this.doTestRead();
		this.doTestUpdate();
		this.doTestDelete();
	}

	private void doTestCreate() throws Exception {
		CriticalFunctionExample dObj = new CriticalFunctionExample();
		dObj.setSystemDomainId(PlanTestData.wellknown_institution);
		dObj.setPlans("TEST");

		// create
		this.dao.create(dObj);

		// test
		assertNotNull(dObj.getId());
	}

	private void doTestRead() throws Exception {
		CriticalFunctionExample dObj = this.getLatest();
		CriticalFunctionExample dSameObj = this.dao.getById(dObj.getId());
		assertNotNull(dSameObj);
	}

	private void doTestUpdate() throws Exception {
		CriticalFunctionExample dObj = this.getLatest();
		String modPlans = dObj.getPlans() + "-Modified";
		dObj.setPlans(modPlans);

		// update
		this.dao.update(dObj);

		// test
		CriticalFunctionExample modObj = this.dao.getById(dObj.getId());
		assertEquals(modPlans, modObj.getPlans());
	}

	private void doTestDelete() throws Exception {
		CriticalFunctionExample dObj = this.getLatest();

		// delete
		this.dao.delete(dObj.getId());

		// test
		CriticalFunctionExample nullObj = this.dao.getById(dObj.getId());
		assertNull(nullObj);
	}

	private CriticalFunctionExample getLatest() throws Exception {
		List<CriticalFunctionExample> dObjs = this.dao.getListBySystemDomainId(PlanTestData.wellknown_institution);
		return dObjs.get(dObjs.size()-1);
	}

}