text:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
*
* Clase que representa un Modelo para Enlazar las Estadisticas de las aplicaciones.
*
* Esta clase mapea la tabla ethas_applications de  la base de datos no relacional de DynamoDB.
*
* @author Andres Felipe Herrera <anfho93@gmail.com>
*  @version 1.1
*/
include_once 'BaseStatistics.php';
class Eventstatistics extends BaseStatistics {
    private $separador ="-";

    /**
    * Metodo constructor del modelo.
    */
    function __construct()
    {
      parent::__construct();
      $this->otherdb = $this->load->database('impala', TRUE);
      try{
        //$this->otherdb->query("invalidate metadata downloads");
        //  $this->otherdb->query("refresh downloads");
        //  print_r($this->otherdb->error());
        if($this->otherdb->error()["code"]!=null)
        {
         return;
        }
         //print_r($this->otherdb->error());
       // $this->otherdb->query("refresh default.logs");
        if($this->otherdb->error()["code"]!=null)
        {
         return;
        }
      }catch(Exception $e)
      {
          return;
      }
    }
   /**
    * Retorna un arreglo indexado por fechas  de los eventos de una aplicacion
    * @param String $idApp Nombre de la aplicacion.
     * @param string $initialDate fecha inicial
     * @param String $finalDate fecha final
    * @return array datos indexados por fechas
    */
    public function getEventsDailyData($idApp, $initialDate, $finalDate){
       @list($d1, $m1, $y1) = explode( $this->separador,$initialDate,3);
       @list($d2, $m2, $y2) = explode( $this->separador,$finalDate,3);
        $c=$this->getConector($y1, $y2);
        if($this->getSegmentQuery()!=null)
        {
            //print_r($this->getSegmentQuery());
            //$this->otherdb->query("invalidate metadata downloads");
            //$this->otherdb->query("refresh logs");
            $this->otherdb->select(" logs.year, logs.month, logs.day, count(logs.log) as Events");
            $this->otherdb->from("logs");
            $this->otherdb->join('downloads', ' logs.id_app= downloads.id_app     and  downloads.id_download= logs.id_download');
            $this->otherdb->where("logs.id_app", $idApp);
            $this->otherdb->where("((logs.year = $y1 and ( $m1 < logs.month or ($m1= logs.month and logs.day >= $d1 and logs.day <= 31 ) ))  $c
                                 (logs.year = $y2 and ( $m2 > logs.month or ($m2=logs.month and logs.day >= 01 and $d2 >= logs.day ))))");
            $this->otherdb->group_by("logs.year, logs.month , logs.day");
            $this->otherdb->order_by("logs.year, logs.month , logs.day");
            $this->addSegmentQuery($this->otherdb);
            $result = $this->otherdb->get();
        }else{
            $this->db->select(" year, month, day, SUM(events) as events");
            $this->db->from("dailylogs");
            $this->db->where("id_app", $idApp);
            $this->db->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                                       (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
            $this->db->group_by("year, month , day");
            $this->db->order_by("year, month , day");
            $result = $this->db->get();
        }
        $titles = array("Events");
        $labels = $this->prepareResultSet($titles, $initialDate, $finalDate, $result->result_array());
        return  $labels;
    }
    /**
    * Obtiene las catergorias de una aplicacion y la cantidad de eventos
     * registrados en un rango de tiempo
    * @param String $idApp Nombre de la aplicacion.
    * @param string $initialDate fecha inicial
    * @param String $finalDate fecha final
    * @return array tabla con las diferentes categorias y numero de eventos
    */
    public function getEventsCategories($idApp, $initialDate, $finalDate){
        @list($d1, $m1, $y1) = explode( $this->separador,$initialDate,3);
        @list($d2, $m2, $y2) = explode( $this->separador,$finalDate,3);
        $c=$this->getConector($y1, $y2);
        if($this->getSegmentQuery()!=null)
        {
             $this->otherdb->select("category, count(id_session) as events");
             $this->otherdb->from("logs");
             $this->otherdb->where("id_app", $idApp);
             $this->otherdb->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                  (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
             $this->otherdb->group_by("category");
             $this->addSegmentQuery($this->otherdb);
             $result = $this->otherdb->get();
        }else{
             $this->db->select("category, SUM(events) as events");
             $this->db->from("dailylogs");
             $this->db->where("id_app", $idApp);
             $this->db->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                  (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
             $this->db->group_by("category");
             $result = $this->db->get();
        }
        return   $result->result_array();
    }

    /**
    *Obtiene los tipos de eventos de una aplicacion y la cantidad de eventos
    * registrados en un rango de tiempo
    * @param String $idApp Nombre de la aplicacion.
    * @param string $initialDate fecha inicial
    * @param String $finalDate fecha final
    * @return array tabla con las diferentes categorias y numero de eventos
    */
    public function getTypes($idApp, $initialDate, $finalDate){
        @list($d1, $m1, $y1) = explode( $this->separador,$initialDate,3);
        @list($d2, $m2, $y2) = explode( $this->separador,$finalDate,3);
        $c=$this->getConector($y1, $y2);
        if($this->getSegmentQuery()!=null){
             $this->otherdb->select("type , count(id_session)");
             $this->otherdb->from("logs");
             $this->otherdb->where("id_app", $idApp);
             $this->otherdb->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                         (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
             $this->otherdb->group_by("type");
             $this->addSegmentQuery($this->otherdb);
             $result = $this->otherdb->get();
        }else{
            $this->db->select("type , sum(events)");
            $this->db->from("dailylogs");
            $this->db->where("id_app", $idApp);
            $this->db->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                             (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
            $this->db->group_by("type");
            $result = $this->db->get();
        }
        return   $result->result_array();
    }
    /**
    *Obtiene los nombres de eventos de una aplicacion y la cantidad de eventos
    * registrados en un rango de tiempo
    * @param String $idApp Nombre de la aplicacion.
    * @param string $initialDate fecha inicial
    * @param String $finalDate fecha final
    * @return array tabla con las diferentes nombres de eventos y numero de eventos
    */
     public function getLogs($idApp, $initialDate, $finalDate){
        @list($d1, $m1, $y1) = explode( $this->separador,$initialDate,3);
        @list($d2, $m2, $y2) = explode( $this->separador,$finalDate,3);
        $c=$this->getConector($y1, $y2);
        if($this->getSegmentQuery()!=null){
            $this->otherdb->select(" log , count(id_session)");
            $this->otherdb->from("logs");
            $this->otherdb->where("id_app", $idApp);
            $this->otherdb->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                             (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
            $this->otherdb->group_by("log");
            $this->addSegmentQuery($this->otherdb);
            $result = $this->otherdb->get();
        }else{
            $this->db->select(" log , sum(events)");
            $this->db->from("dailylogs");
            $this->db->where("id_app", $idApp);
            $this->db->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                             (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
            $this->db->group_by("log");
            $result = $this->db->get();
        }
        return   $result->result_array();
    }
    /**
    *Obtiene los tipos de eventos de una categoria especifica y la cantidad de eventos
    * registrados en un rango de tiempo
    * @param String $idApp Nombre de la aplicacion.
    * @param string $initialDate fecha inicial
    * @param String $finalDate fecha final
    * @return array tabla con las diferentes categorias y numero de eventos
    */
    public function getCategoryTypes($idApp, $initialDate, $finalDate, $categoryname){
        @list($d1, $m1, $y1) = explode( $this->separador,$initialDate,3);
        @list($d2, $m2, $y2) = explode( $this->separador,$finalDate,3);
        $c=$this->getConector($y1, $y2);
         if($this->getSegmentQuery()!=null){
            $this->otherdb->select(" type, count(id_session) as events");
            $this->otherdb->from("logs");
            $this->otherdb->where("id_app", $idApp);
            $this->otherdb->where("category", $categoryname);
            $this->otherdb->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                         (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
            $this->otherdb->group_by("type");
            $this->addSegmentQuery($this->otherdb);
            $result = $this->otherdb->get();
         }else{
            $this->db->select(" type, SUM(events) as events");
            $this->db->from("dailylogs");
            $this->db->where("id_app", $idApp);
            $this->db->where("category", $categoryname);
            $this->db->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                         (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
            $this->db->group_by("type");
            $result = $this->db->get();
         }
         return   $result->result_array();
    }

    /**
    *Obtiene los eventos de un tipo especifico y la cantidad de eventos
    * registrados en un rango de tiempo
    * @param String $idApp Nombre de la aplicacion.
    * @param string $initialDate fecha inicial
    * @param String $finalDate fecha final
    * @param string $category nombre de la categoria del evento,
     * @param string $type nombre del tipo de evento
    * @return array tabla con las diferentes eventos y numero de ocurrencias
    */
    public function getLogsFromCategoryTypes($idApp, $initialDate, $finalDate, $category, $type){
        @list($d1, $m1, $y1) = explode( $this->separador,$initialDate,3);
        @list($d2, $m2, $y2) = explode( $this->separador,$finalDate,3);
        $c=$this->getConector($y1, $y2);
         if($this->getSegmentQuery()!=null){
                $this->otherdb->select("log, count(id_session) as events");
                $this->otherdb->from("logs");
                $this->otherdb->where("id_app", $idApp);
                $this->otherdb->where("category", $category);
                $this->otherdb->where("type", $type);
                $this->otherdb->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                                 (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
                $this->otherdb->group_by("log");
                $this->addSegmentQuery($this->otherdb);

                $result = $this->otherdb->get();
        }else{
                $this->db->select("log, sum(events) as events");
                $this->db->from("dailylogs");
                $this->db->where("id_app", $idApp);
                $this->db->where("category", $category);
                $this->db->where("type", $type);
                $this->db->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                                 (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
                $this->db->group_by("log");

                $result = $this->db->get();
        }

        return   $result->result_array();
    }
 /**
    *Obtiene los valores de un evento especifico y la cantidad de eventos
    * registrados con dicho valor en un rango de tiempo
    * @param String $idApp Nombre de la aplicacion.
    * @param string $initialDate fecha inicial
    * @param String $finalDate fecha final
    * @param string $category, nombre de la categoria del evento,
     * @param string $type nombre del tipo de evento
  * * @param string $log nombre del evento
    * @return array tabla con las diferentes eventos y numero de ocurrencias
    */
    public function getValuesFromLogs($idApp, $initialDate, $finalDate, $category, $type, $log){
        @list($d1, $m1, $y1) = explode( $this->separador,$initialDate,3);
        @list($d2, $m2, $y2) = explode( $this->separador,$finalDate,3);
        $c=$this->getConector($y1, $y2);
        if($this->getSegmentQuery()!=null){
            $this->otherdb->select("value, count(id_session) as events");
            $this->otherdb->from("logs");
            $this->otherdb->where("id_app", $idApp);
            $this->otherdb->where("category", $category);
            $this->otherdb->where("type", $type);
            $this->otherdb->where("log", $type);
            $this->otherdb->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                             (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
            $this->otherdb->group_by("log, value");
            $result = $this->otherdb->get();
        }else{
             $this->db->select("value, SUM(events) as events");
             $this->db->from("dailylogs");
             $this->db->where("id_app", $idApp);
             $this->db->where("category", $category);
             $this->db->where("type", $type);
             $this->db->where("log", $type);
             $this->db->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                         (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
             $this->db->group_by("log, value");
             $result = $this->db->get();
        }
        return   $result->result_array();
    }

    /**
     * Permite obtener datos de los eventos generados por los
     * usuarios basados en el nombre de una categoria
     * @param String $idApp Nombre de la aplicacion.
     * @param string $initialDate fecha inicial
     * @param String $finalDate fecha final
     * @param String $category nombre de la categoria
     * @return array resultado de la consulta agrupado por year, month, day
     */
    public function getCategoryDailyData($idApp, $initialDate, $finalDate, $category){
        @list($d1, $m1, $y1) = explode( $this->separador,$initialDate,3);
        @list($d2, $m2, $y2) = explode( $this->separador,$finalDate,3);

        $c=$this->getConector($y1, $y2);
        if($this->getSegmentQuery()!=null){
           $this->otherdb->select("year, month, day, category, count(id_session) as Events");
            $this->otherdb->from("logs");
            $this->otherdb->where("id_app", $idApp);
            $this->otherdb->where("category", $category);
            $this->otherdb->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                         (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
            $this->otherdb->group_by("year, month, day, category");
            $this->otherdb->order_by(" month, day, category");
            $result = $this->otherdb->get();
        }else{
            $this->db->select("year, month, day, category, sum(events) as events");
            $this->db->from("dailylogs");
            $this->db->where("id_app", $idApp);
            $this->db->where("category", $category);
            $this->db->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                         (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
            $this->db->group_by("year, month, day, category");
            $this->db->order_by(" month, day, category");
            $result = $this->db->get();
        }

         $titlearray = array("Events");
         return   $this->prepareResultSet($titlearray, $initialDate, $finalDate, $result->result_array());
    }
    /**
     * Permite obtener datos de los eventos generados por los
     * usuarios basados en el nombre de una categoria y un tipo de evento
     * @param String $idApp Nombre de la aplicacion.
     * @param string $initialDate fecha inicial
     * @param String $finalDate fecha final
     * @param String $type nombre de la categoria
     * @param String $category nombre de la categoria
     * @return array resultado de la consulta agrupado por year, month, day
     */
    public function getTypeDailyData($idApp, $initialDate, $finalDate, $type, $category =  null){
        @list($d1, $m1, $y1) = explode( $this->separador,$initialDate,3);
        @list($d2, $m2, $y2) = explode( $this->separador,$finalDate,3);
        $c=$this->getConector($y1, $y2);
          if($this->getSegmentQuery()!=null){
               $this->otherdb->select("year, month, day, type, count(id_session) as events");
               $this->otherdb->from("logs");
               $this->otherdb->where("id_app", $idApp);
               $this->otherdb->where("type", $type);
               $this->otherdb->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                                    (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
                if($category != null){
                  $this->otherdb->where("category", $category);
                }
                $this->otherdb->group_by("year, month, day, type");
                $this->otherdb->order_by("year, month, day");
                $this->addSegmentQuery($this->otherdb);
                $result = $this->otherdb->get();
          }else{
               $this->db->select("year, month, day, type, SUM(events) as events");
                $this->db->from("dailylogs");
                $this->db->where("id_app", $idApp);
                $this->db->where("type", $type);

                $this->db->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                                        (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
              if($category != null)
                   {
                     $this->db->where("category", $category);
                   }
                $this->db->group_by("year, month, day, type");
                $this->db->order_by("year, month, day");
                $this->addSegmentQuery($this->db);
                $result = $this->db->get();
          }
         $titlearray = array("Events");
         return   $this->prepareResultSet($titlearray, $initialDate, $finalDate, $result->result_array());
    }
    /**
     * Permite obtener datos de los eventos generados por los
     * usuarios basados en el nombre de un evento
     * @param String $idApp Nombre de la aplicacion.
     * @param string $initialDate fecha inicial
     * @param String $finalDate fecha final
     * @param String $log nombre de la categoria
     * @return array resultado de la consulta agrupado por year, month, day
     */
    public function getLogDailyData($idApp,  $initialDate, $finalDate, $log){
        @list($d1, $m1, $y1) = explode( $this->separador,$initialDate,3);
        @list($d2, $m2, $y2) = explode( $this->separador,$finalDate,3);
        $c=$this->getConector($y1, $y2);
        if($this->getSegmentQuery()!=null){
            $this->otherdb->select(" year, month, day, type, count(id_session) as events");
            $this->otherdb->from("logs");
            $this->otherdb->where("id_app", $idApp);
            $this->otherdb->where("log", $log);
            $this->otherdb->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                                (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
            $this->otherdb->group_by("year, month, day, type");
            $this->otherdb->order_by("month, day, type");
            $this->addSegmentQuery($this->otherdb);
            $result = $this->otherdb->get();
        }else{
            $this->db->select(" year, month, day, type, SUM(events) as events");
            $this->db->from("dailylogs");
            $this->db->where("id_app", $idApp);
            $this->db->where("log", $log);
            $this->db->where("((year = $y1 and ( $m1 < month or ($m1=month and day >= $d1 and day <= 31 ) ))  $c
                                (year = $y2 and ( $m2 > month or ($m2=month and day >= 01 and $d2 >= day ))))");
            $this->db->group_by("year, month, day, type");
            $this->db->order_by("month, day, type");
            $result = $this->db->get();
        }

         $titlearray = array("Events");
         return   $this->prepareResultSet($titlearray, $initialDate, $finalDate, $result->result_array());
    }
}


text:
#include "CX/precomp.hpp"
#include "CX/Platform.hpp"

#if defined(CX_OS_WINDOWS)

#include "CX/IO/FileInputStream.hpp"
#include "CX/Str/UTF8.hpp"
#include "CX/Status.hpp"

namespace CX
{

namespace IO
{

FileInputStream::FileInputStream(const Char *szPath)
{
	WString wsPath;

	m_hFile = NULL;
	m_sPath = szPath;
	if (Str::UTF8::ToWChar(szPath, &wsPath).IsOK())
	{
		OpenFile(wsPath.c_str());
	}
}

FileInputStream::FileInputStream(const WChar *wszPath)
{
	m_hFile = NULL;
	Str::UTF8::FromWChar(wszPath, &m_sPath);
	OpenFile(wszPath);
}

FileInputStream::~FileInputStream()
{
	if (NULL != m_hFile)
	{
		CloseHandle(m_hFile);
		m_hFile = NULL;
	}
}

Status FileInputStream::OpenFile(const WChar *wszPath)
{
	if (INVALID_HANDLE_VALUE == (m_hFile = CreateFileW(wszPath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
	                                                   OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)))
	{
		m_hFile = NULL;

		return Status(Status_OpenFailed, "CreateFileW failed with error {1}", GetLastError());
	}

	return Status();
}

Status FileInputStream::Read(void *pBuffer, Size cbReqSize, Size *pcbAckSize)
{
	if (NULL == m_hFile)
	{
		return Status(Status_NotInitialized, "File not opened");
	}
	if ((Size)TYPE_UINT32_MAX < cbReqSize)
	{
		return Status_TooBig;
	}

	DWORD dwAckSize;

	if (!ReadFile(m_hFile, pBuffer, (DWORD)cbReqSize, &dwAckSize, NULL))
	{
		return Status(Status_OpenFailed, "ReadFile failed with error {1}", GetLastError());
	}
	*pcbAckSize = (Size)dwAckSize;
	if (0 == dwAckSize)
	{
		return Status_EOF;
	}

	return Status();
}

Status FileInputStream::SetPos(UInt64 cbPos)
{
	if (NULL == m_hFile)
	{
		return Status(Status_NotInitialized, "File not opened");
	}

	LARGE_INTEGER liPos;

	liPos.QuadPart = cbPos;
	if (!SetFilePointerEx(m_hFile, liPos, NULL, FILE_BEGIN))
	{
		return Status(Status_OperationFailed, "SetFilePointerEx failed with error {1}", GetLastError());
	}

	return Status();
}

Status FileInputStream::GetPos(UInt64 *pcbPos) const
{
	if (NULL == m_hFile)
	{
		return Status(Status_NotInitialized, "File not opened");
	}

	LARGE_INTEGER liPos;
	LARGE_INTEGER liAckPos;

	liPos.QuadPart = 0;
	if (!SetFilePointerEx(m_hFile, liPos, &liAckPos, FILE_CURRENT))
	{
		return Status(Status_OperationFailed, "SetFilePointerEx failed with error {1}", GetLastError());
	}
	*pcbPos = (UInt64)liAckPos.QuadPart;

	return Status();
}

Status FileInputStream::GetSize(UInt64 *pcbSize) const
{
	if (NULL == m_hFile)
	{
		return Status(Status_NotInitialized, "File not opened");
	}

	LARGE_INTEGER liSize;

	if (!GetFileSizeEx(m_hFile, &liSize))
	{
		return Status(Status_OperationFailed, "GetFileSizeEx failed with error {1}", GetLastError());
	}
	*pcbSize = liSize.QuadPart;

	return Status();
}

Bool FileInputStream::IsEOF() const
{
	if (NULL == m_hFile)
	{
		return True;
	}

	UInt64   cbSize;
	UInt64   cbPos;
	Status   status;

	if (!(status = GetPos(&cbPos)))
	{
		return True;
	}
	if (!(status = GetSize(&cbSize)))
	{
		return True;
	}

	return (cbPos >= cbSize);
}

Bool FileInputStream::IsOK() const
{
	return (NULL != m_hFile);
}

const Char *FileInputStream::GetPath() const
{
	if (NULL == m_hFile)
	{
		return "";
	}

	return m_sPath.c_str();
}

}//namespace IO

}//namespace CX

#endif

redpajama_set_name: RedPajamaGithub


text:
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding model 'PhotoSceneCategory'
        db.create_table(u'photos_photoscenecategory', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=127)),
            ('description', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('parent', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['photos.PhotoSceneCategory'], null=True, blank=True)),
        ))
        db.send_create_signal(u'photos', ['PhotoSceneCategory'])

        # Adding model 'FlickrUser'
        db.create_table(u'photos_flickruser', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('username', self.gf('django.db.models.fields.CharField')(max_length=127)),
            ('blacklisted', self.gf('django.db.models.fields.BooleanField')(default=False)),
        ))
        db.send_create_signal(u'photos', ['FlickrUser'])

        # Adding model 'PhotoLightStack'
        db.create_table(u'photos_photolightstack', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('slug', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)),
        ))
        db.send_create_signal(u'photos', ['PhotoLightStack'])

        # Adding model 'Photo'
        db.create_table(u'photos_photo', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('added', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
            ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['accounts.UserProfile'])),
            ('image_orig', self.gf('django.db.models.fields.files.ImageField')(max_length=100)),
            ('aspect_ratio', self.gf('django.db.models.fields.FloatField')(null=True)),
            ('description', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('exif', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('fov', self.gf('django.db.models.fields.FloatField')(null=True)),
            ('focal_y', self.gf('django.db.models.fields.FloatField')(null=True)),
            ('license', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='photos', null=True, to=orm['licenses.License'])),
            ('light_stack', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='photos', null=True, to=orm['photos.PhotoLightStack'])),
            ('special', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('inappropriate', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
            ('nonperspective', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
            ('stylized', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
            ('rotated', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
            ('scene_category', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='photos', null=True, to=orm['photos.PhotoSceneCategory'])),
            ('scene_category_correct', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
            ('scene_category_correct_score', self.gf('django.db.models.fields.FloatField')(null=True, blank=True)),
            ('whitebalanced', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
            ('whitebalanced_score', self.gf('django.db.models.fields.FloatField')(null=True, blank=True)),
            ('flickr_user', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='photos', null=True, to=orm['photos.FlickrUser'])),
            ('flickr_id', self.gf('django.db.models.fields.CharField')(max_length=64, null=True, blank=True)),
            ('md5', self.gf('django.db.models.fields.CharField')(max_length=32)),
            ('vanishing_lines', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('vanishing_points', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('vanishing_length', self.gf('django.db.models.fields.FloatField')(null=True, blank=True)),
            ('num_shapes', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('num_vertices', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('num_intrinsic_comparisons', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('num_intrinsic_points', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('median_intrinsic_error', self.gf('django.db.models.fields.FloatField')(null=True, blank=True)),
        ))
        db.send_create_signal(u'photos', ['Photo'])

        # Adding model 'PhotoSceneQualityLabel'
        db.create_table(u'photos_photoscenequalitylabel', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('added', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
            ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['accounts.UserProfile'])),
            ('mturk_assignment', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='+', null=True, on_delete=models.SET_NULL, to=orm['mturk.MtAssignment'])),
            ('sandbox', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('invalid', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('quality_method', self.gf('django.db.models.fields.CharField')(max_length=1, null=True, blank=True)),
            ('time_ms', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
            ('time_active_ms', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
            ('reward', self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=8, decimal_places=4, blank=True)),
            ('photo', self.gf('django.db.models.fields.related.ForeignKey')(related_name='scene_qualities', to=orm['photos.Photo'])),
            ('correct', self.gf('django.db.models.fields.BooleanField')(default=False)),
        ))
        db.send_create_signal(u'photos', ['PhotoSceneQualityLabel'])

        # Adding model 'PhotoWhitebalanceLabel'
        db.create_table(u'photos_photowhitebalancelabel', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('added', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
            ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['accounts.UserProfile'])),
            ('mturk_assignment', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='+', null=True, on_delete=models.SET_NULL, to=orm['mturk.MtAssignment'])),
            ('sandbox', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('invalid', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('quality_method', self.gf('django.db.models.fields.CharField')(max_length=1, null=True, blank=True)),
            ('time_ms', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
            ('time_active_ms', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)),
            ('reward', self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=8, decimal_places=4, blank=True)),
            ('photo', self.gf('django.db.models.fields.related.ForeignKey')(related_name='whitebalances', to=orm['photos.Photo'])),
            ('points', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('num_points', self.gf('django.db.models.fields.IntegerField')()),
            ('chroma_median', self.gf('django.db.models.fields.FloatField')(null=True, blank=True)),
            ('whitebalanced', self.gf('django.db.models.fields.BooleanField')(default=False)),
        ))
        db.send_create_signal(u'photos', ['PhotoWhitebalanceLabel'])

    def backwards(self, orm):
        # Deleting model 'PhotoSceneCategory'
        db.delete_table(u'photos_photoscenecategory')

        # Deleting model 'FlickrUser'
        db.delete_table(u'photos_flickruser')

        # Deleting model 'PhotoLightStack'
        db.delete_table(u'photos_photolightstack')

        # Deleting model 'Photo'
        db.delete_table(u'photos_photo')

        # Deleting model 'PhotoSceneQualityLabel'
        db.delete_table(u'photos_photoscenequalitylabel')

        # Deleting model 'PhotoWhitebalanceLabel'
        db.delete_table(u'photos_photowhitebalancelabel')

    models = {
        u'accounts.userprofile': {
            'Meta': {'object_name': 'UserProfile'},
            'always_approve': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'blocked': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'blocked_reason': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'exclude_from_aggregation': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'mturk_worker_id': ('django.db.models.fields.CharField', [], {'max_length': '127', 'blank': 'True'}),
            'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'user'", 'unique': 'True', 'primary_key': 'True', 'to': u"orm['auth.User']"})
        },
        u'auth.group': {
            'Meta': {'object_name': 'Group'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
        },
        u'auth.permission': {
            'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        },
        u'auth.user': {
            'Meta': {'object_name': 'User'},
            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}),
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
        },
        u'contenttypes.contenttype': {
            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
        },
        u'licenses.license': {
            'Meta': {'object_name': 'License'},
            'added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'cc_attribution': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'cc_no_deriv': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'cc_noncommercial': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'cc_share_alike': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'creative_commons': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
            'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'url': ('django.db.models.fields.URLField', [], {'max_length': '255', 'blank': 'True'})
        },
        u'mturk.experiment': {
            'Meta': {'ordering': "['slug', 'variant']", 'unique_together': "(('slug', 'variant'),)", 'object_name': 'Experiment'},
            'added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'completed_id': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
            'cubam_dirty': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'examples_group_attr': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
            'has_tutorial': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'module': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
            'new_hit_settings': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'experiments'", 'null': 'True', 'to': u"orm['mturk.ExperimentSettings']"}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),
            'template_dir': ('django.db.models.fields.CharField', [], {'default': "'mturk/experiments'", 'max_length': '255'}),
            'test_contents_per_assignment': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
            'variant': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'version': ('django.db.models.fields.IntegerField', [], {'default': '1'})
        },
        u'mturk.experimentsettings': {
            'Meta': {'object_name': 'ExperimentSettings'},
            'added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'auto_add_hits': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'auto_approval_delay': ('django.db.models.fields.IntegerField', [], {'default': '2592000'}),
            'content_filter': ('django.db.models.fields.TextField', [], {'default': "'{}'"}),
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'experiment_settings_in'", 'to': u"orm['contenttypes.ContentType']"}),
            'contents_per_hit': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'duration': ('django.db.models.fields.IntegerField', [], {'default': '1800'}),
            'feedback_bonus': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '8', 'decimal_places': '4', 'blank': 'True'}),
            'frame_height': ('django.db.models.fields.IntegerField', [], {'default': '800'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'keywords': ('django.db.models.fields.CharField', [], {'max_length': '1000'}),
            'lifetime': ('django.db.models.fields.IntegerField', [], {'default': '2678400'}),
            'max_active_hits': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'max_total_hits': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'min_output_consensus': ('django.db.models.fields.IntegerField', [], {'default': '4'}),
            'num_outputs_max': ('django.db.models.fields.IntegerField', [], {'default': '5'}),
            'out_content_attr': ('django.db.models.fields.CharField', [], {'max_length': '127', 'blank': 'True'}),
            'out_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'experiment_settings_out'", 'null': 'True', 'to': u"orm['contenttypes.ContentType']"}),
            'out_count_ratio': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
            'qualifications': ('django.db.models.fields.TextField', [], {'default': "'{}'"}),
            'requirements': ('django.db.models.fields.TextField', [], {'default': "'{}'"}),
            'reward': ('django.db.models.fields.DecimalField', [], {'max_digits': '8', 'decimal_places': '4'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
        },
        u'mturk.experimenttestcontent': {
            'Meta': {'ordering': "['-id']", 'object_name': 'ExperimentTestContent'},
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
            'experiment': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'test_contents'", 'to': u"orm['mturk.Experiment']"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
            'priority': ('django.db.models.fields.FloatField', [], {'default': '0', 'db_index': 'True'})
        },
        u'mturk.mtassignment': {
            'Meta': {'object_name': 'MtAssignment'},
            'accept_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
            'action_log': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'approval_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
            'approve_message': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'auto_approval_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
            'bonus': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '8', 'decimal_places': '2', 'blank': 'True'}),
            'bonus_message': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'deadline': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
            'feedback': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'feedback_bonus_given': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'has_feedback': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'hit': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'assignments'", 'to': u"orm['mturk.MtHit']"}),
            'id': ('django.db.models.fields.CharField', [], {'max_length': '128', 'primary_key': 'True'}),
            'manually_rejected': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'num_test_contents': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'num_test_correct': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'num_test_incorrect': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'partially_completed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'post_data': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'post_meta': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'reject_message': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'rejection_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
            'screen_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'screen_width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'status': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True', 'blank': 'True'}),
            'submission_complete': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'submit_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
            'test_contents': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'assignments'", 'symmetrical': 'False', 'to': u"orm['mturk.ExperimentTestContent']"}),
            'time_active_ms': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'time_load_ms': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'time_ms': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
            'user_agent': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'wage': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
            'worker': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['accounts.UserProfile']", 'null': 'True', 'blank': 'True'})
        },
        u'mturk.mthit': {
            'Meta': {'object_name': 'MtHit'},
            'added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'all_submitted_assignments': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'any_submitted_assignments': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'compatible_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'expired': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'hit_status': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True', 'blank': 'True'}),
            'hit_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'hits'", 'to': u"orm['mturk.MtHitType']"}),
            'id': ('django.db.models.fields.CharField', [], {'max_length': '128', 'primary_key': 'True'}),
            'incompatible_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'lifetime': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'max_assignments': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
            'num_assignments_available': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'num_assignments_completed': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'num_assignments_pending': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'num_contents': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'out_count_ratio': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
            'review_status': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True', 'blank': 'True'}),
            'sandbox': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
        },
        u'mturk.mthittype': {
            'Meta': {'object_name': 'MtHitType'},
            'added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'auto_approval_delay': ('django.db.models.fields.IntegerField', [], {'default': '2592000'}),
            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'duration': ('django.db.models.fields.IntegerField', [], {'default': '3600'}),
            'experiment': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'hit_types'", 'to': u"orm['mturk.Experiment']"}),
            'experiment_settings': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'hit_types'", 'to': u"orm['mturk.ExperimentSettings']"}),
            'external_url': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'feedback_bonus': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '8', 'decimal_places': '2', 'blank': 'True'}),
            'frame_height': ('django.db.models.fields.IntegerField', [], {'default': '800'}),
            'id': ('django.db.models.fields.CharField', [], {'max_length': '128', 'primary_key': 'True'}),
            'keywords': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'blank': 'True'}),
            'reward': ('django.db.models.fields.DecimalField', [], {'default': "'0.01'", 'max_digits': '8', 'decimal_places': '4'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
        },
        u'photos.flickruser': {
            'Meta': {'ordering': "['-id']", 'object_name': 'FlickrUser'},
            'blacklisted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'username': ('django.db.models.fields.CharField', [], {'max_length': '127'})
        },
        u'photos.photo': {
            'Meta': {'ordering': "['aspect_ratio', '-id']", 'object_name': 'Photo'},
            'added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'aspect_ratio': ('django.db.models.fields.FloatField', [], {'null': 'True'}),
            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'exif': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'flickr_id': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}),
            'flickr_user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'photos'", 'null': 'True', 'to': u"orm['photos.FlickrUser']"}),
            'focal_y': ('django.db.models.fields.FloatField', [], {'null': 'True'}),
            'fov': ('django.db.models.fields.FloatField', [], {'null': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'image_orig': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}),
            'inappropriate': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
            'license': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'photos'", 'null': 'True', 'to': u"orm['licenses.License']"}),
            'light_stack': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'photos'", 'null': 'True', 'to': u"orm['photos.PhotoLightStack']"}),
            'md5': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
            'median_intrinsic_error': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
            'nonperspective': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
            'num_intrinsic_comparisons': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'num_intrinsic_points': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'num_shapes': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'num_vertices': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'rotated': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
            'scene_category': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'photos'", 'null': 'True', 'to': u"orm['photos.PhotoSceneCategory']"}),
            'scene_category_correct': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
            'scene_category_correct_score': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
            'special': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'stylized': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['accounts.UserProfile']"}),
            'vanishing_length': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
            'vanishing_lines': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'vanishing_points': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'whitebalanced': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
            'whitebalanced_score': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'})
        },
        u'photos.photolightstack': {
            'Meta': {'ordering': "['-id']", 'object_name': 'PhotoLightStack'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
        },
        u'photos.photoscenecategory': {
            'Meta': {'ordering': "['name']", 'object_name': 'PhotoSceneCategory'},
            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '127'}),
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['photos.PhotoSceneCategory']", 'null': 'True', 'blank': 'True'})
        },
        u'photos.photoscenequalitylabel': {
            'Meta': {'ordering': "['photo', '-time_ms']", 'object_name': 'PhotoSceneQualityLabel'},
            'added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'correct': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'invalid': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'mturk_assignment': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': u"orm['mturk.MtAssignment']"}),
            'photo': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'scene_qualities'", 'to': u"orm['photos.Photo']"}),
            'quality_method': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True', 'blank': 'True'}),
            'reward': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '8', 'decimal_places': '4', 'blank': 'True'}),
            'sandbox': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'time_active_ms': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
            'time_ms': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['accounts.UserProfile']"})
        },
        u'photos.photowhitebalancelabel': {
            'Meta': {'ordering': "['photo', '-time_ms']", 'object_name': 'PhotoWhitebalanceLabel'},
            'added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'chroma_median': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'invalid': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'mturk_assignment': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': u"orm['mturk.MtAssignment']"}),
            'num_points': ('django.db.models.fields.IntegerField', [], {}),
            'photo': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'whitebalances'", 'to': u"orm['photos.Photo']"}),
            'points': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'quality_method': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True', 'blank': 'True'}),
            'reward': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '8', 'decimal_places': '4', 'blank': 'True'}),
            'sandbox': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'time_active_ms': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
            'time_ms': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['accounts.UserProfile']"}),
            'whitebalanced': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
        }
    }

    complete_apps = ['photos']


text:
package com.slugterra.entity.protoform;

import com.slugterra.entity.EntitySlug;
import com.slugterra.item.SlugItemRegistry;

import net.minecraft.entity.EntityAgeable;
import net.minecraft.world.World;

public class EntityJellyish extends EntitySlug{

	public EntityJellyish(World p_i1738_1_) {
		super(p_i1738_1_);
		this.slugItem = SlugItemRegistry.jellyish;
	}

	@Override
	public EntityAgeable createChild(EntityAgeable p_90011_1_) {
		return new EntityJellyish(world);
	}
}


text:
namespace atom {

class AtomBindings;
class NodeBindings;

class AtomRendererClient : public content::ContentRendererClient,
                           public content::RenderProcessObserver {
 public:
  AtomRendererClient();
  virtual ~AtomRendererClient();

 private:
  enum NodeIntegration {
    ALL,
    EXCEPT_IFRAME,
    MANUAL_ENABLE_IFRAME,
    DISABLE,
  };

  // content::RenderProcessObserver:
  void WebKitInitialized() override;

  // content::ContentRendererClient:
  void RenderThreadStarted() override;
  void RenderViewCreated(content::RenderView*) override;
  blink::WebSpeechSynthesizer* OverrideSpeechSynthesizer(
      blink::WebSpeechSynthesizerClient* client) override;
  bool OverrideCreatePlugin(content::RenderFrame* render_frame,
                            blink::WebLocalFrame* frame,
                            const blink::WebPluginParams& params,
                            blink::WebPlugin** plugin) override;
  void DidCreateScriptContext(blink::WebFrame* frame,
                              v8::Handle<v8::Context> context,
                              int extension_group,
                              int world_id) override;
  bool ShouldFork(blink::WebFrame* frame,
                  const GURL& url,
                  const std::string& http_method,
                  bool is_initial_navigation,
                  bool is_server_redirect,
                  bool* send_referrer) override;

  void EnableWebRuntimeFeatures();

  scoped_ptr<NodeBindings> node_bindings_;
  scoped_ptr<AtomBindings> atom_bindings_;

  // The main frame.
  blink::WebFrame* main_frame_;

  DISALLOW_COPY_AND_ASSIGN(AtomRendererClient);
};

}  // namespace atom

#endif  // ATOM_RENDERER_ATOM_RENDERER_CLIENT_H_


text:
<?xml version="1.0"?>
<template>

  <!-- This is the template for reading geometry in OpenMC -->

  <options rootname="geometry" />

  <typedef name="cell_xml">
    <component name="id" type="integer" />
    <component name="universe" type="integer" default="0" />
    <component name="material" type="word" length="12" default="''" />
    <component name="fill" type="integer" default="0" />
    <component name="surfaces" type="integer-array" />
    <component name="rotation" type="double-array" />
    <component name="translation" type="double-array" />
    <component name="roi" type="word" length="5" default= "'false'" />
    <component name="buffer" type="word" length="5" default="'false'" />
  </typedef>

  <typedef name="surface_xml">
    <component name="id" type="integer" />
    <component name="type" type="word" length="15" />
    <component name="coeffs" type="double-array" />
    <component name="boundary" type="word" length="12" default="'transmit'" />
  </typedef>

  <typedef name="lattice_xml">
    <component name="id" type="integer" />
    <component name="type" type="word" length="12" default="'rectangular'" />
    <component name="dimension" type="integer-array" />
    <component name="lower_left" type="double-array" />
    <component name="width" type="double-array" />
    <component name="universes" type="integer-array" />
    <component name="outside" type="integer" default="0"/>
  </typedef>

  <variable name="cell_" tag="cell" type="cell_xml" dimension="1" />
  <variable name="surface_" tag="surface" type="surface_xml" dimension="1" />
  <variable name="lattice_" tag="lattice" type="lattice_xml" dimension="1" />

</template>


text:
void
test_bson_cursor_get_javascript (void)
{
  bson *b;
  bson_cursor *c;
  const gchar *s = "deadbeef";

  ok (bson_cursor_get_javascript (NULL, &s) == FALSE,
      "bson_cursor_get_javascript() with a NULL cursor fails");

  b = test_bson_generate_full ();
  c = bson_cursor_new (b);

  ok (bson_cursor_get_javascript (c, NULL) == FALSE,
      "bson_cursor_get_javascript() with a NULL destination fails");
  ok (bson_cursor_get_javascript (c, &s) == FALSE,
      "bson_cursor_get_javascript() at the initial position fails");
  is (s, "deadbeef",
      "destination remains unchanged after failed cursor operations");
  bson_cursor_free (c);

  c = bson_find (b, "alert");
  ok (bson_cursor_get_javascript (c, &s),
      "bson_cursor_get_javascript() works");
  is (s, "alert (\"hello world!\");",
      "bson_cursor_get_javascript() returns the correct result");

  bson_cursor_next (c);
  ok (bson_cursor_get_javascript (c, &s) == FALSE,
      "bson_cursor_get_javascript() should fail when the cursor points to "
      "non-javascript data");

  bson_cursor_free (c);
  bson_free (b);
}

RUN_TEST (7, bson_cursor_get_javascript);


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Naucoria umbrina Bres.

### Remarks
null


text:
\begin{figure}[H]
\centering
\includegraphics[width=6in]{figs/run_43/run_43_ctke_vs_r_mesh_scatter}
\caption{Scatter plot of turbulent kinetic energy vs radius at $z/c$=9.00, $V_{free}$=19.08, station5}
\label{fig:run_43_ctke_vs_r_mesh_scatter}
\end{figure}


text:
NSString * const TCTicketDidSaleCompleteNotification = @"com.jianghongbing.ticketDidSaleComplete";

@interface TicketCenter()
@property(nonatomic) NSUInteger totalTicketCount;
@property(nonatomic) NSUInteger remainderTicketCount;
@property(nonatomic,strong) NSRecursiveLock *lock;
@property(nonatomic,strong) NSMutableSet *saleWindows;
@end
@implementation TicketCenter
@synthesize remainderTicketCount = _remainderTicketCount;

+ (instancetype)defaultCenter {
    static TicketCenter *center;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        center = [[TicketCenter alloc] init];
    });
    return center;
}

- (instancetype)init {
    self = [super init];
    if (self) {
        _totalTicketCount = _remainderTicketCount = 10000;
        _lock = [[NSRecursiveLock alloc] init];
        _saleWindows = [NSMutableSet set];
    }
    return self;
}

#pragma mark getter && setter
- (void)setRemainderTicketCount:(NSUInteger)remainderTicketCount {
    [self.lock lock];
    _remainderTicketCount = remainderTicketCount;
    [self.lock unlock];
}

- (NSUInteger)remainderTicketCount {
    [self.lock lock];
    NSUInteger tempRemainderTicketCount = _remainderTicketCount;
    [self.lock unlock];
    return tempRemainderTicketCount;
}

- (NSUInteger)reminderTickets {
    [self.lock lock];
    NSUInteger remianderTicketCount =  self.remainderTicketCount;
    [self.lock unlock];
    return remianderTicketCount;
}

- (void)saleTicket {
    [self.lock lock];
    self.remainderTicketCount = self.remainderTicketCount - 1;
    if (self.remainderTicketCount == 0) {
        [self.saleWindows enumerateObjectsUsingBlock:^(TicketSaleWindow *window, BOOL * _Nonnull stop) {
            [window stopSaleTicket];
        }];
        dispatch_async(dispatch_get_main_queue(), ^{
            [[NSNotificationCenter defaultCenter] postNotificationName:TCTicketDidSaleCompleteNotification object:nil];
        });
    }
    [self.lock unlock];
}

- (void)returnTicket {
    [self.lock lock];
    self.remainderTicketCount = self.remainderTicketCount + 1;
    [self.lock unlock];
}

- (void)suspendSaleTicket {
    [self.saleWindows enumerateObjectsUsingBlock:^(TicketSaleWindow *window, BOOL * _Nonnull stop) {
        [window suspendSaleTicket];
    }];
}

- (void)addTicketSaleWindow:(TicketSaleWindow *)window {
    [self.saleWindows addObject:window];
}

- (void)removeTicketSaleWindow:(TicketSaleWindow *)window {
    [self.saleWindows removeObject:window];
}

@end


text:
#region copyright

#endregion

namespace YAF.Types.Flags
{
  using System;

  /// <summary>
  /// The access flags.
  /// </summary>
  public class AccessFlags : FlagsBase
  {
    #region Constructors

    /// <summary>
    /// Initializes a new instance of the <see cref="AccessFlags"/> class.
    /// </summary>
    public AccessFlags()
      : this(0)
    {
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="AccessFlags"/> class.
    /// </summary>
    /// <param name="flags">
    /// The flags.
    /// </param>
    public AccessFlags(Flags flags)
        : this((int)flags)
    {
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="AccessFlags"/> class.
    /// </summary>
    /// <param name="bitValue">
    /// The bit value.
    /// </param>
    public AccessFlags(object bitValue)
        : this((int)bitValue)
    {
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="AccessFlags"/> class.
    /// </summary>
    /// <param name="bitValue">
    /// The bit value.
    /// </param>
    public AccessFlags(int bitValue)
      : base(bitValue)
    {
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="AccessFlags"/> class.
    /// </summary>
    /// <param name="bits">
    /// The bits.
    /// </param>
    public AccessFlags(params bool[] bits)
      : base(bits)
    {
    }

    #endregion

    #region Operators

    /// <summary>
    /// The op_ implicit.
    /// </summary>
    /// <param name="newBitValue">
    /// The new bit value.
    /// </param>
    /// <returns>
    /// </returns>
    public static implicit operator AccessFlags(int newBitValue)
    {
      var flags = new AccessFlags(newBitValue);
      return flags;
    }

    /// <summary>
    /// The op_ implicit.
    /// </summary>
    /// <param name="flags">
    /// The flags.
    /// </param>
    /// <returns>
    /// </returns>
    public static implicit operator AccessFlags(Flags flags)
    {
      return new AccessFlags(flags);
    }

    #endregion

    #region Flags Enumeration

    /// <summary>
    /// Use for bit comparisons
    /// </summary>
    [Flags]
    public enum Flags
    {
      None = 0,

      /// <summary>
      /// The read access.
      /// </summary>
      ReadAccess = 1,

      /// <summary>
      /// The post access.
      /// </summary>
      PostAccess = 2,

      /// <summary>
      /// The reply access.
      /// </summary>
      ReplyAccess = 4,

      /// <summary>
      /// The priority access.
      /// </summary>
      PriorityAccess = 8,

      /// <summary>
      /// The poll access.
      /// </summary>
      PollAccess = 16,

      /// <summary>
      /// The vote access.
      /// </summary>
      VoteAccess = 32,

      /// <summary>
      /// The moderator access.
      /// </summary>
      ModeratorAccess = 64,

      /// <summary>
      /// The edit access.
      /// </summary>
      EditAccess = 128,

      /// <summary>
      /// The delete access.
      /// </summary>
      DeleteAccess = 256,

      /// <summary>
      /// The upload access.
      /// </summary>
      UploadAccess = 512,

      /// <summary>
      /// The download access.
      /// </summary>
      DownloadAccess = 1024,

      /// <summary>
      /// The create user forum access.
      /// </summary>
      UserForumAccess = 32768
    }

    #endregion

    #region Single Flags (can be 32 of them)

    /// <summary>
    /// Gets or sets read access right.
    /// </summary>
    public bool ReadAccess
    {
      // int value 1
      get
      {
        return this[0];
      }

      set
      {
        this[0] = value;
      }
    }

    /// <summary>
    /// Gets or sets post access right.
    /// </summary>
    public bool PostAccess
    {
      // int value 2
      get
      {
        return this[1];
      }

      set
      {
        this[1] = value;
      }
    }

    /// <summary>
    /// Gets or sets reply access right.
    /// </summary>
    public bool ReplyAccess
    {
      // int value 4
      get
      {
        return this[2];
      }

      set
      {
        this[2] = value;
      }
    }

    /// <summary>
    /// Gets or sets priority access right.
    /// </summary>
    public bool PriorityAccess
    {
      // int value 8
      get
      {
        return this[3];
      }

      set
      {
        this[3] = value;
      }
    }

    /// <summary>
    /// Gets or sets poll access right.
    /// </summary>
    public bool PollAccess
    {
      // int value 16
      get
      {
        return this[4];
      }

      set
      {
        this[4] = value;
      }
    }

    /// <summary>
    /// Gets or sets vote access right.
    /// </summary>
    public bool VoteAccess
    {
      // int value 32
      get
      {
        return this[5];
      }

      set
      {
        this[5] = value;
      }
    }

    /// <summary>
    /// Gets or sets moderator access right.
    /// </summary>
    public bool ModeratorAccess
    {
      // int value 64
      get
      {
        return this[6];
      }

      set
      {
        this[6] = value;
      }
    }

    /// <summary>
    /// Gets or sets edit access right.
    /// </summary>
    public bool EditAccess
    {
      // int value 128
      get
      {
        return this[7];
      }

      set
      {
        this[7] = value;
      }
    }

    /// <summary>
    /// Gets or sets delete access right.
    /// </summary>
    public bool DeleteAccess
    {
      // int value 256
      get
      {
        return this[8];
      }

      set
      {
        this[8] = value;
      }
    }

    /// <summary>
    /// Gets or sets upload access right.
    /// </summary>
    public bool UploadAccess
    {
      // int value 512
      get
      {
        return this[9];
      }

      set
      {
        this[9] = value;
      }
    }

    /// <summary>
    /// Gets or sets download access right.
    /// </summary>
    public bool DownloadAccess
    {
      // int value 1024
      get
      {
        return this[10];
      }

      set
      {
        this[10] = value;
      }
    }

    /// <summary>
    /// Gets or sets a value indicating whether create user forum access.
    /// </summary>
    public bool UserForumAccess
    {
        // int value 32768
        get
        {
            return this[this.EnumToIndex(Flags.UserForumAccess)];
        }

        set
        {
            this[this.EnumToIndex(Flags.UserForumAccess)] = value;
        }
    }

    #endregion
  }
}


text:
class CPF
  class VerifierDigit
    def self.generate(numbers)
      modulus = numbers.size + 1

      multiplied = numbers.map.each_with_index do |number, index|
        number * (modulus - index)
      end

      mod = multiplied.sum % 11
      mod < 2 ? 0 : 11 - mod
    end
  end
end


text:
package org.apache.maven.plugins.enforcer;

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

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactCollector;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.enforcer.rule.api.EnforcerRule;
import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.enforcer.utils.DependencyVersionMap;
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.dependency.tree.DependencyNode;
import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder;
import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.i18n.I18N;

/**
 * @author Rex Hoffman
 */
public class DependencyConvergence
    implements EnforcerRule
{

    private static Log log;

    private static I18N i18n;

    private boolean uniqueVersions;

    public void setUniqueVersions( boolean uniqueVersions )
    {
        this.uniqueVersions = uniqueVersions;
    }

    // CHECKSTYLE_OFF: LineLength
    /**
     * Uses the {@link EnforcerRuleHelper} to populate the values of the
     * {@link DependencyTreeBuilder#buildDependencyTree(MavenProject, ArtifactRepository, ArtifactFactory, ArtifactMetadataSource, ArtifactFilter, ArtifactCollector)}
     * factory method.

     * This method simply exists to hide all the ugly lookup that the {@link EnforcerRuleHelper} has to do.
     *
     * @param helper
     * @return a Dependency Node which is the root of the project's dependency tree
     * @throws EnforcerRuleException
     */
    // CHECKSTYLE_ON: LineLength
    private DependencyNode getNode( EnforcerRuleHelper helper )
        throws EnforcerRuleException
    {
        try
        {
            MavenProject project = (MavenProject) helper.evaluate( "${project}" );
            DependencyTreeBuilder dependencyTreeBuilder =
                (DependencyTreeBuilder) helper.getComponent( DependencyTreeBuilder.class );
            ArtifactRepository repository = (ArtifactRepository) helper.evaluate( "${localRepository}" );
            ArtifactFactory factory = (ArtifactFactory) helper.getComponent( ArtifactFactory.class );
            ArtifactMetadataSource metadataSource =
                (ArtifactMetadataSource) helper.getComponent( ArtifactMetadataSource.class );
            ArtifactCollector collector = (ArtifactCollector) helper.getComponent( ArtifactCollector.class );
            ArtifactFilter filter = null; // we need to evaluate all scopes
            DependencyNode node =
                dependencyTreeBuilder.buildDependencyTree( project, repository, factory, metadataSource, filter,
                                                           collector );
            return node;
        }
        catch ( ExpressionEvaluationException e )
        {
            throw new EnforcerRuleException( "Unable to lookup an expression " + e.getLocalizedMessage(), e );
        }
        catch ( ComponentLookupException e )
        {
            throw new EnforcerRuleException( "Unable to lookup a component " + e.getLocalizedMessage(), e );
        }
        catch ( DependencyTreeBuilderException e )
        {
            throw new EnforcerRuleException( "Could not build dependency tree " + e.getLocalizedMessage(), e );
        }
    }

    public void execute( EnforcerRuleHelper helper )
        throws EnforcerRuleException
    {
        if ( log == null )
        {
            log = helper.getLog();
        }
        try
        {
            if ( i18n == null )
            {
                i18n = (I18N) helper.getComponent( I18N.class );
            }
            DependencyNode node = getNode( helper );
            DependencyVersionMap visitor = new DependencyVersionMap( log );
            visitor.setUniqueVersions( uniqueVersions );
            node.accept( visitor );
            List<CharSequence> errorMsgs = new ArrayList<CharSequence>();
            errorMsgs.addAll( getConvergenceErrorMsgs( visitor.getConflictedVersionNumbers() ) );
            for ( CharSequence errorMsg : errorMsgs )
            {
                log.warn( errorMsg );
            }
            if ( errorMsgs.size() > 0 )
            {
                throw new EnforcerRuleException( "Failed while enforcing releasability the error(s) are " + errorMsgs );
            }
        }
        catch ( ComponentLookupException e )
        {
            throw new EnforcerRuleException( "Unable to lookup a component " + e.getLocalizedMessage(), e );
        }
        catch ( Exception e )
        {
            throw new EnforcerRuleException( e.getLocalizedMessage(), e );
        }
    }

    private String getFullArtifactName( Artifact artifact )
    {
        return artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();
    }

    private StringBuilder buildTreeString( DependencyNode node )
    {
        List<String> loc = new ArrayList<String>();
        DependencyNode currentNode = node;
        while ( currentNode != null )
        {
            loc.add( getFullArtifactName( currentNode.getArtifact() ) );
            currentNode = currentNode.getParent();
        }
        Collections.reverse( loc );
        StringBuilder builder = new StringBuilder();
        for ( int i = 0; i < loc.size(); i++ )
        {
            for ( int j = 0; j < i; j++ )
            {
                builder.append( "  " );
            }
            builder.append( "+-" + loc.get( i ) );
            builder.append( "\n" );
        }
        return builder;
    }

    private List<String> getConvergenceErrorMsgs( List<List<DependencyNode>> errors )
    {
        List<String> errorMsgs = new ArrayList<String>();
        for ( List<DependencyNode> nodeList : errors )
        {
            errorMsgs.add( buildConvergenceErrorMsg( nodeList ) );
        }
        return errorMsgs;
    }

    private String buildConvergenceErrorMsg( List<DependencyNode> nodeList )
    {
        StringBuilder builder = new StringBuilder();
        builder.append( "\nDependency convergence error for " + getFullArtifactName( nodeList.get( 0 ).getArtifact() )
            + " paths to dependency are:\n" );
        if ( nodeList.size() > 0 )
        {
            builder.append( buildTreeString( nodeList.get( 0 ) ) );
        }
        for ( DependencyNode node : nodeList.subList( 1, nodeList.size() ) )
        {
            builder.append( "and\n" );
            builder.append( buildTreeString( node ) );
        }
        return builder.toString();
    }

    /**
     * If your rule is cacheable, you must return a unique id when parameters or conditions change that would cause the
     * result to be different. Multiple cached results are stored based on their id. The easiest way to do this is to
     * return a hash computed from the values of your parameters. If your rule is not cacheable, then the result here is
     * not important, you may return anything.
     */
    public String getCacheId()
    {
        return "";
    }

    /**
     * This tells the system if the results are cacheable at all. Keep in mind that during forked builds and other
     * things, a given rule may be executed more than once for the same project. This means that even things that change
     * from project to project may still be cacheable in certain instances.
     */
    public boolean isCacheable()
    {
        return false;
    }

    /**
     * If the rule is cacheable and the same id is found in the cache, the stored results are passed to this method to
     * allow double checking of the results. Most of the time this can be done by generating unique ids, but sometimes
     * the results of objects returned by the helper need to be queried. You may for example, store certain objects in
     * your rule and then query them later.
     *
     * @param rule
     */
    public boolean isResultValid( EnforcerRule rule )
    {
        return false;
    }
}


text:
using OrchardCore.ContentManagement.Metadata;
using OrchardCore.ContentManagement.Metadata.Settings;
using OrchardCore.Data.Migration;

namespace OrchardCore.Forms
{
    public class Migrations : DataMigration
    {
        private readonly IContentDefinitionManager _contentDefinitionManager;

        public Migrations(IContentDefinitionManager contentDefinitionManager)
        {
            _contentDefinitionManager = contentDefinitionManager;
        }

        public int Create()
        {
            // Form
            _contentDefinitionManager.AlterPartDefinition("FormPart", part => part
                .Attachable()
                .WithDescription("Turns your content item into a form."));

            _contentDefinitionManager.AlterTypeDefinition("Form", type => type
                .WithPart("TitlePart")
                .WithPart("FormPart")
                .WithPart("FlowPart")
                .Stereotype("Widget"));

            // FormElement
            _contentDefinitionManager.AlterPartDefinition("FormElementPart", part => part
                .WithDescription("Provides attributes common to all form elements."));

            // FormInputElement
            _contentDefinitionManager.AlterPartDefinition("FormInputElementPart", part => part
                .WithDescription("Provides attributes common to all input form elements."));

            // Label
            _contentDefinitionManager.AlterPartDefinition("LabelPart", part => part
                .WithDescription("Provides label properties."));

            _contentDefinitionManager.AlterTypeDefinition("Label", type => type
                .WithPart("TitlePart")
                .WithPart("FormElementPart")
                .WithPart("LabelPart")
                .Stereotype("Widget"));

            // Input
            _contentDefinitionManager.AlterPartDefinition("InputPart", part => part
                .WithDescription("Provides input field properties."));

            _contentDefinitionManager.AlterTypeDefinition("Input", type => type
                .WithPart("FormInputElementPart")
                .WithPart("FormElementPart")
                .WithPart("InputPart")
                .Stereotype("Widget"));

            // TextArea
            _contentDefinitionManager.AlterPartDefinition("TextAreaPart", part => part
                .WithDescription("Provides text area properties."));

            _contentDefinitionManager.AlterTypeDefinition("TextArea", type => type
                .WithPart("FormInputElementPart")
                .WithPart("FormElementPart")
                .WithPart("TextAreaPart")
                .Stereotype("Widget"));

            // Select
            _contentDefinitionManager.AlterPartDefinition("SelectPart", part => part
                .WithDescription("Provides select field properties."));

            _contentDefinitionManager.AlterTypeDefinition("Select", type => type
                .WithPart("FormInputElementPart")
                .WithPart("FormElementPart")
                .WithPart("SelectPart")
                .Stereotype("Widget"));

            // Button
            _contentDefinitionManager.AlterPartDefinition("ButtonPart", part => part
                .WithDescription("Provides button properties."));

            _contentDefinitionManager.AlterTypeDefinition("Button", type => type
                .WithPart("FormInputElementPart")
                .WithPart("FormElementPart")
                .WithPart("ButtonPart")
                .Stereotype("Widget"));

            // Validation Summary
            _contentDefinitionManager.AlterPartDefinition("ValidationSummaryPart", part => part
                .WithDescription("Displays a validation summary."));

            _contentDefinitionManager.AlterTypeDefinition("ValidationSummary", type => type
                .WithPart("ValidationSummaryPart")
                .Stereotype("Widget"));

            // Validation
            _contentDefinitionManager.AlterPartDefinition("ValidationPart", part => part
                .WithDescription("Displays a field validation error."));

            _contentDefinitionManager.AlterTypeDefinition("Validation", type => type
                .WithPart("ValidationPart")
                .Stereotype("Widget"));

            return 1;
        }
    }
}


text:
describe("Model.Local", function(){
  var User;

  beforeEach(function(){
    User = RSpine.Model.setup("User", ["name"]);
  });

  it("should persist attributes", function(){
    User.extend(RSpine.Model.Local);
    User.create({name: "Bob"});
    User.fetch();

    expect(User.first()).toBeTruthy();
    expect(User.first().name).toEqual("Bob");
  });

  it("should work with cIDs", function(){
    User.refresh([
      {name: "Bob", id: "c-1"},
      {name: "Bob", id: "c-3"},
      {name: "Bob", id: "c-2"}
    ]);
    expect(User.idCounter).toEqual(3);
  });

  it("should work with a blank refresh", function(){
    User.refresh([]);
    expect(User.idCounter).toEqual(0);
  });

  describe(".saveLocal", function(){
    beforeEach(function(){
      User.extend(RSpine.Model.Local);
    });

    it("should store User JSON data in localStorage", function(){
      var data = [
        {name: "Bob", id: "c-1"}
      ];
      User.refresh(data);

      delete localStorage['User'];
      expect(localStorage['User']).toEqual(undefined);
      User.saveLocal();
      expect(localStorage['User']).toEqual(JSON.stringify(data));
    });
  });

  describe(".loadLocal", function(){
    beforeEach(function(){
      User.extend(RSpine.Model.Local);
      var data = [
        {name: "Bob", id: "c-1"}
      ];
      localStorage['User'] = JSON.stringify(data);
    });

    it("should read User JSON data from localStorage and refresh User", function(){
      expect(User.count()).toEqual(0);
      User.loadLocal();
      expect(User.count()).toEqual(1);
    });

    it("should not delete existing records when set clear option to false", function(){
      User.refresh([
        {name: "Bob", id: "c-0"}
      ]);
      expect(User.count()).toEqual(1);
      User.loadLocal({clear: false});
      expect(User.count()).toEqual(2);
    });
  });

});


text:
/*********************************************************************************
* (Use Comparator) Write the following generic method using selection sort and a *
* comparator.                                                                    *
*                                                                                *
* public static <E> void selectionSort(E[] list,                                 *
* 	 Comparator<? super E> comparator)                                            *
*                                                                                *
* Write a test program that creates an array of 10 GeometricObjects and invokes  *
* this method using the GeometricObjectComparator introduced in Listing 20.4 to  *
* sort the elements. Display the sorted elements.                                *
*********************************************************************************/
import java.util.Comparator;

public class Exercise_20_21 {
	public static void main(String[] args) {
		// Create an array of 10 GeometricObjects
		GeometricObject[] list = {new Circle(5), new Rectangle(4, 5),
			new Circle(5.5), new Rectangle(2.4, 5), new Circle(0.5),
			new Rectangle(4, 65), new Circle(4.5), new Rectangle(4.4, 1),
			new Circle(6.5), new Rectangle(4, 5)};

		// Invoke selection sort using GeometricObjectComparator
		selectionSort(list, new GeometricObjectComparator());

		// Display the sorted elements
		System.out.print("Sorted elements: ");
		for (GeometricObject e: list) {
				System.out.printf("%.2f ", e.getArea());
		}
		System.out.println();
	}

	/** Generic selection sort method */
	public static <E> void selectionSort(E[] list,
			Comparator<? super E> comparator) {
		for (int i = 0; i < list.length - 1; i++) {
			// Find the minimum in the list[i..list.length-1]
			E currentMin = list[i];
			int currentMinIndex = i;

			for (int j = i + 1; j < list.length; j++) {
				if (comparator.compare(currentMin, list[j]) > 0) {
				currentMin = list[j];
				currentMinIndex = j;
			}
		}

		// Swap list[i] with list[currentMinIndex] if necessary
		if (currentMinIndex != i) {
				list[currentMinIndex] = list[i];
				list[i] = currentMin;
			}
		}
	}
}


text:
define(
	[
		'underscore', 'backbone', '../models/project', '../models/iteration',
		'text!../tmpls/iteration_delete.html', 'text!../tmpls/errors.html'
	],
	function (
		_, Backbone, ProjectModel, IterationModel, IterationDeleteTmpl, ErrorsTmpl
	) {
		'use strict';

		var DeleteIterationView = Backbone.View.extend({
			el: '#main-container',

			events: {
				'click #confirm-delete-iteration-btn': 'deleteIteration',
				'click #cancel-delete-iter-btn': 'cancelDeleteIter'
			},

			template: _.template(IterationDeleteTmpl),
			error_template: _.template(ErrorsTmpl),

			/*
			 * Initialize delete iteration view
			 * @param {object} option Object, contains iteration and project ids
			 */
			initialize: function(options) {
				if (options.project_id && options.iteration_id) {
					this.project = new ProjectModel({id: options.project_id});
					this.iteration = new IterationModel({id: options.iteration_id});
					this.render();
				}
			},

			/*
			 * Render delete iteration template
			 */
			render: function() {
				var _self = this;
				this.project.fetch({
					success: function(project) {
						_self.iteration.fetch({
							success: function(iteration) {
								_self.$el.html( _self.template({project: project, iteration: iteration}) );
							},
							error: function() {
								_self.$el.html(_self.error_template( {error_message: 'Error! Internal server error!'} ));
							}
						});
					},
					error: function() {
						_self.$el.html(_self.error_template( {error_message: 'Error! Internal server error!'} ));
					}
				});
			},

			/*
			 * Delete current iteration from server
			 * @param {object} event Backbone event object
			 * @return {boolean} false
			 */
			deleteIteration: function(event) {
				var _self = this;
				this.iteration.destroy({
					success: function() {
						_self.undelegateEvents();
						window.location.replace('#projects/' + _self.project.get('id') + '/iterations');
					},
					error: function() {
						_self.$el.html(_self.error_template( {error_message: 'Error! Internal server error!'} ));
					}
				});
				return false;
			},

			cancelDeleteIter: function() {
				window.location.replace('#projects/' + this.project.get('id') + '/iterations');
			}

		});

		return DeleteIterationView;
	});