text:
require('2param_node');

function LGraphOperation()
{
    this.output_types = this.output_types || null;
    this.out_extra_info = this.out_extra_info || {types_list: {float:1},   use_t:1};
    this.intput_typesA = this.intput_typesA || null;
    this.in_extra_infoA = this.in_extra_infoA || {types_list: {float:1, vec3:1, vec4:1, vec2:1},   use_t:1}
    this.intput_typesB = this.intput_typesB || null;
    this.in_extra_infoB = this.in_extra_infoB || {types_list: {float:1, vec3:1, vec4:1, vec2:1},   use_t:1};
//    this.output_types = {vec2:1, float:1, vec3:1,  vec4:1};
//    this.intput_typesA = {vec2:1, float:1, vec3:1,  vec4:1};
//    this.intput_typesB = {vec2:1, float:1, vec3:1, vec4:1};

    this.number_piece = new PConstant("float"); // hardcoded when the inputs are null
    this.properties = { A:0.0, B:0.0};

    LGraph2ParamNode.call( this);
}
LGraphOperation.prototype = Object.create(LGraph2ParamNode);
LGraphOperation.prototype.constructor = LGraphOperation;

LGraphOperation.prototype.infereTypes = function( output_slot, target_slot, node) {

    var out_types = node.getTypesFromOutputSlot(output_slot);
    if( Object.keys(out_types)[0] == "float")
        return;

    this.connectTemplateSlot();

    var input = this.inputs[target_slot];
    if (input.use_t && Object.keys(this.T_in_types).length === 0) {

        this.T_in_types["float"] = 1; // we hardcode the float as operation always accept float in one of the inputs
        for (var k in out_types)
            this.T_in_types[k] = out_types[k];
        for (var k in out_types)
            this.T_out_types[k] = out_types[k];
    }

}

LGraphOperation.prototype.onGetNullCode = function(slot, scope)
{
    if(slot == 0){
        var code = this.number_piece.getCode(
            {
                out_var:"float_A"+this.id,
                a:this.properties["A"].toFixed(3),
                scope:scope,
                order:this.order-1
            });
        return code;
    } else if(slot == 1){
        var code = this.number_piece.getCode(
            {
                out_var:"float_B"+this.id,
                a:this.properties["B"].toFixed(3),
                scope:scope,
                order:this.order-1
        });
        return code;
    }

}

LGraphOperation.prototype.onDrawBackground = function(ctx)
{
    this.inputs[0].label = "A";
    if(!this.isInputConnected(0))
        this.inputs[0].label += "="+this.properties["A"].toFixed(3);

    this.inputs[1].label = "B";
    if(!this.isInputConnected(1))
        this.inputs[1].label += "="+this.properties["B"].toFixed(3);
}

LiteGraph.extendClass(LGraphOperation,LGraph2ParamNode);


text:
package com.jaquadro.minecraft.storagedrawers.security;

import com.jaquadro.minecraft.storagedrawers.api.security.ISecurityProvider;

import java.util.HashMap;
import java.util.Map;

public class SecurityRegistry
{
    private final Map<String, ISecurityProvider> registry = new HashMap<>();

    public void registerProvider (ISecurityProvider provider) {
        registry.put(provider.getProviderID(), provider);
    }

    public ISecurityProvider getProvider (String name) {
        return registry.get(name);
    }
}

redpajama_set_name: RedPajamaGithub


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Kew Bull. , Addit. Ser. 9: 436 (1983)

#### Original name
Agaricus caribaeus Pegler

### Remarks
null


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid android:color="#BCBCBC" />
    <size
        android:width="40dp"
        android:height="40dp" />
</shape>


text:
<?php

namespace Skaphandrus\AppBundle\Controller;

// Used Entities
// Used Forms

use Ivory\GoogleMap\Exception\OverlayException;
use Ivory\GoogleMap\Map;
use Ivory\GoogleMap\MapTypeId;
use Ivory\GoogleMap\Overlays\Animation;
use Ivory\GoogleMap\Overlays\InfoWindow;
use Ivory\GoogleMap\Overlays\Marker;
use Skaphandrus\AppBundle\Entity\FosUser;
use Skaphandrus\AppBundle\Utils\Utils;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse as JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Intl\Intl;
use Symfony\Component\Routing\Exception\InvalidParameterException;

class DefaultController extends Controller {

    public function indexAction(Request $request) {
        $em = $this->getDoctrine()->getManager();

        $modules = $em->getRepository('SkaphandrusAppBundle:SkIdentificationModule')
                ->findBy(array('isEnabled' => '1'), array('updatedAt' => 'DESC'), 8);

        $contestsInProgress = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhotoContest')
                ->findContestsInProgress();

        $contestsEnded = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhotoContest')
                ->findContestsEnded();

//        $contests = $em->getRepository('SkaphandrusAppBundle:SkPhotoContest')
//                ->findBy(array('isVisible' => true), array('createdAt' => 'DESC'), 8);

        $photos = $em->getRepository('SkaphandrusAppBundle:SkPhoto')
                ->findBy(array(), array('validatedRating' => 'DESC'), 30);

        $business = $em->getRepository('SkaphandrusAppBundle:SkBusiness')
                ->findBy(array(), array('createdAt' => 'DESC'), 3);

//        $business = $em->getRepository('SkaphandrusAppBundle:SkBusiness')->findBusinessPremiumOrPlus();

//        $show = $request->query->get('show', false);
//
//        if ($show == false):
//            $show = $this->checkCountry('PT');
//        endif;

        return $this->render('SkaphandrusAppBundle:Default:index.html.twig', array(
                    'modules' => $modules,
                    'contestsInProgress' => $contestsInProgress,
                    'contestsEnded' => $contestsEnded,
                    'photos' => $photos,
                    'business' => $business,
//                    'show' => $show
        ));
    }

    public function testThumbnailAction() {
        $em = $this->getDoctrine()->getManager();
        $photos = $em->getRepository('SkaphandrusAppBundle:SkPhoto')->findBy(array('fosUser' => '5'), array('id' => 'DESC'), 10);

        return $this->render('SkaphandrusAppBundle:Default:testThumbnail.html.twig', array('photos' => $photos));
    }

    public function testSmartLinkAction() {

        return $this->render('SkaphandrusAppBundle:Default:testSmartLink.html.twig');
    }

    public function index2Action() {
//        $location = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkLocation')
//                ->findOneWithTranslations(21);

        return $this->render('SkaphandrusAppBundle:Default:index2.html.twig');
    }

    public function homepageAction() {
        return $this->render('SkaphandrusAppBundle:Default:homepage.html.twig');
    }

    public function helloAction($name) {
        return $this->render('SkaphandrusAppBundle:Default:index.html.twig', array('name' => $name));
    }

    /**
     *
     * @param type $name
     * @return type
     *
     * Migração dos utilizadores da base de dados sfUser
     *
     */
    public function usersMigrationActionOld() {
        $dbHost = $this->container->getParameter('database_host');
        $dbUser = $this->container->getParameter('database_user');
        $dbPassword = $this->container->getParameter('database_password');
        $dbName = $this->container->getParameter('database_name');
        $dbPort = $this->container->getParameter('database_port');

        $em = $this->container->get('doctrine.orm.entity_manager');
        $um = $this->container->get('fos_user.user_manager');

        $mysqli = new \mysqli($dbHost, $dbUser, $dbPassword, $dbName, $dbPort);
        $result = $mysqli->query('SELECT * FROM sf_guard_user');
        $userSfGuard = $result->fetch_object();

        while ($userSfGuard = $result->fetch_object()) {
            $userFOS = $um->createUser();
            $userFOS->setId($userSfGuard->username);
            $userFOS->setUsername($userSfGuard->username);
            $userFOS->setEmail($userSfGuard->username);
            $userFOS->setPassword($userSfGuard->password);
            $userFOS->setSalt($userSfGuard->salt);

            $em->persist($userFOS);
        }
        $em->flush();

        return $this->render('SkaphandrusAppBundle:Default:usersMigration.html.php');
    }

    /**
     * Users migration from sfUser database.
     *
     * The id is saved accordingly with:
     * http://www.ens.ro/2012/07/03/symfony2-doctrine-force-entity-id-on-persist/
     */
    public function usersMigrationAction() {
        $dbHost = $this->container->getParameter('database_host');
        $dbUser = $this->container->getParameter('database_user');
        $dbPassword = $this->container->getParameter('database_password');
        $dbName = $this->container->getParameter('database_name');
        $dbPort = $this->container->getParameter('database_port');

        $em = $this->container->get('doctrine.orm.entity_manager');
        $um = $this->container->get('fos_user.user_manager');
        $em->getClassMetaData(get_class(new FosUser()))
                ->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_NONE);

        $mysqli = new \mysqli($dbHost, $dbUser, $dbPassword, $dbName, $dbPort);
        $result = $mysqli->query('SELECT * FROM sf_guard_user');

        $i = 0;
        while ($userSfGuard = $result->fetch_object()) {
            $userFOS = $um->createUser();
            $userFOS->setId($userSfGuard->id);
            $userFOS->setUsername($userSfGuard->username);
            $userFOS->setEmail($userSfGuard->username);
            $userFOS->setPassword($userSfGuard->password);
            $userFOS->setSalt($userSfGuard->salt);
            $userFOS->setAlgorithm($userSfGuard->algorithm);

            $em->persist($userFOS);
            $i++;
        }
        $em->flush();

        return $this->render('SkaphandrusAppBundle:Default:usersMigration.html.twig', array(
                    'total' => $i,
        ));
    }

    public function taxonomyAction() {
        return $this->render('SkaphandrusAppBundle:Default:taxonomy.html.twig');
    }

    public function sourceAction() {
        $id = $this->get('request')->query->get('id');
        $locale = $this->get('request')->getLocale();

        $dados = explode(".", $id);
        $taxon = null;
        $result = array();
        $estado = "";
        $categ_next = "";
        $categ = "";
        $response = array();

        if ($dados[0] == "li") {
            $taxon = $dados[1];
            $parent_id = $dados[2];
        }

        $structure = Utils::taxonomyStructure();

        if (array_key_exists($taxon, $structure)) {
            $result = $this->getDoctrine()->getRepository("SkaphandrusAppBundle:Sk" . ucfirst($taxon))
                    ->findBy(array($structure[$taxon]['parent'] => $parent_id), array('name' => 'ASC'));

            if (!$result) {
                $response[] = array('data' => 'not_exists');
            } else {
                foreach ($result as $object) {
                    $url = $this->generateUrl('taxon', array('node' => $taxon, 'slug' => $object->getName()));
                    $categ_next_id = 'li.' . $structure[$taxon]['next'] . '.' . $object->getId();

                    $response[] = array(
                        'id' => $categ_next_id,
                        'text' => $object->getName(),
                        'icon' => FALSE,
                        'state' => array('opened' => FALSE, 'selected' => FALSE),
                        'children' => TRUE,
                        'a_attr' => array(
                            'href' => $this->generateUrl('taxon', array(
                                'node' => $this->get('translator')->trans($taxon),
                                'slug' => $object->getName(),
                            )),
                        ),
                    );
                }
            }
        } elseif ($taxon == 'species') {
            $result = $this->getDoctrine()->getRepository("SkaphandrusAppBundle:SkSpecies")
                    ->findBy(array('genus' => $parent_id));

            $categ = "species";

            foreach ($result as $object) {
                $sn = $object->getScientificNames();
                $slug = Utils::slugify($sn[0]->getName());
                $url = $this->generateUrl('species', array('slug' => $slug));

                $response[] = array(
                    'text' => $sn[0]->getName() . ', ' . $sn[0]->getAuthor() . '',
                    'icon' => FALSE,
                    'state' => array('opened' => FALSE, 'selected' => FALSE),
                    'children' => FALSE,
                    'a_attr' => array(
                        'href' => $this->generateUrl('species', array(
                            'slug' => $slug,
                        )),
                    ),
                );
            }
        } elseif ($taxon == 'kingdom') {
            $result = $this->getDoctrine()->getRepository("SkaphandrusAppBundle:SkKingdom")
                    ->findBy(array(), array('name' => 'ASC'));

            $categ_next = "phylum";
            $categ = "kingdom";

            foreach ($result as $object) {
                $url = $this->generateUrl('taxon', array('node' => 'kingdom', 'slug' => $object->getName()));
                $categ_next_id = 'li.phylum.' . $object->getId();
                $url = $this->generateUrl('taxon', array(
                    'node' => $this->get('translator')->trans('kingdom'),
                    'slug' => $object->getName(),
                ));

                $response[] = array(
                    'id' => $categ_next_id,
                    'text' => $object->getName(),
                    'icon' => FALSE,
                    'state' => array('opened' => FALSE, 'selected' => FALSE, 'disabled' => FALSE),
                    'children' => TRUE,
                    'a_attr' => array(
                        'href' => $this->generateUrl('taxon', array(
                            'node' => $this->get('translator')->trans('kingdom'),
                            'slug' => $object->getName(),
                        )),
                    ),
                );
            }
        }

        return new JsonResponse($response);
    }

    public function taxonAction($node, $slug) {

        $node = lcfirst($node);

        switch ($node) {
            case 'género':
                $node = 'genus';
                break;
            case 'família':
                $node = 'family';
                break;
            case 'ordem':
                $node = 'order';
                break;
            case 'classe':
                $node = 'class';
                break;
            case 'filo':
                $node = 'phylum';
                break;
            case 'reino':
                $node = 'kingdom';
                break;
            default:
                break;
        }

        $taxon_name = ucfirst($node);

        $taxon = $this->getDoctrine()->getRepository("SkaphandrusAppBundle:Sk" . $taxon_name)
                ->findOneBy(array('name' => $slug));

        if ($taxon) {

            $structure = Utils::taxonomyStructure();

            //next taxon é o nome dos nós filhos, ou seja se estamos numa familia = generos(genus)
            $next_taxon = "";
            $next_taxon_plural = "";

            if (array_key_exists($node, $structure)) {
                $next_taxon = $structure[$node]['next'];
                $next_taxon_plural = $structure[$node]['next_plural'];
            } elseif ($node = 'kingdom') {
                $next_taxon = 'phylum';
                $next_taxon_plural = 'phyla';
            }

            foreach ($taxon->getChildNodes() as $child) {
                $photos = $this->getDoctrine()->getRepository("SkaphandrusAppBundle:SkPhoto")
                                ->getQueryBuilder4(array($child->getTaxonNodeName() => $child->getId()), 10)->getQuery()->getResult();
                $child->setPhotos($photos);
            }

//            $photographers = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:FosUser')
//                    ->findUsersInTaxon($next_taxon, $taxon->getTaxonNodeName(), $taxon->getId());
//
//            $photographers = array();
//            dump($taxon);
//            $qb = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:FosUser')->getQueryBuilder([$taxon->getTaxonNodeName() => $taxon->getId()], 20);
//
//            $photographers = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:FosUser')
//                    ->createNativeNamedQuery('fetchTagsByExpertise')
//                    ->getResult();
//            dump($photographers);

            return $this->render('SkaphandrusAppBundle:Default:taxon.html.twig', array(
                        "node" => $node,
                        "taxon" => $taxon,
                        "next_taxon" => $next_taxon,
                        "next_taxon_plural" => $next_taxon_plural
//                        "photographers" => $photographers
            ));
        } else {
            throw $this->createNotFoundException('The ' . $taxon_name . ' "' . $slug . '" does not exist.');
        }
    }

    public function speciesPageAction($slug) {

        $species = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')->findBySlug($slug);
//        $photos = array();
//        $criterias = array();

        if ($species) {

            $spots = array();

            foreach ($species->getPhotos() as $photo) {
                if ($photo->getSpot() != null):
                    $spots[] = $photo->getSpot();
                endif;
            }

            $map = null;
            $latitude = 0;
            $longitude = 0;
            $centerLatitude = 0;
            $centerLongitude = 0;

            if (count($spots) > 0) {

                // Get markers from spots for the map
                $markers = array();

                foreach ($spots as $spot) {

                    //dump($spot->getCoordinate());
                    if ($spot->getCoordinate()) {

                        try {

                            $marker = new Marker();

                            //remove white spaces
                            $latitude = preg_replace('/\s+/', '', explode(",", $spot->getCoordinate())[0]);
                            $longitude = preg_replace('/\s+/', '', explode(",", $spot->getCoordinate())[1]);

                            $infowindow = new InfoWindow();
                            $spot_url = $this->generateUrl('spot', array(
                                'slug' => $spot->getName(),
                                'location' => $spot->getLocation(),
                                'country' => $spot->getLocation()->getRegion()->getCountry()
                            ));

                            $location_url = $this->generateUrl('location', array(
                                'slug' => $spot->getLocation(),
                                'country' => $spot->getLocation()->getRegion()->getCountry()
                            ));

                            $country_url = $this->generateUrl('country', array(
                                'slug' => $spot->getLocation()->getRegion()->getCountry()
                            ));

                            $contentString = "" . $spot->getName() . ",
                                 " . $spot->getLocation() . ",
                                 " . $spot->getLocation()->getRegion()->getCountry() . "";

                            $infowindow->setContent($contentString);
                            $infowindow->setAutoClose(TRUE);

                            // Marker options
                            $marker->setInfoWindow($infowindow);
                            $marker->setPrefixJavascriptVariable('marker_');
                            $marker->setPosition($latitude, $longitude, true);
                            $marker->setAnimation(Animation::DROP);
                            $marker->setOption('clickable', true);
                            $marker->setOption('flat', true);
                            $marker->setOptions(array(
                                'clickable' => true,
                                'flat' => true,
                            ));

                            $markers[] = $marker;
                        } catch (OverlayException $ex) {
                            //erro coordenada mal ex: 37.0"a"5846492309772, -8.3441162109375
                        } catch (InvalidParameterException $ex) {
                            //erro da constraução do url
                        }
                    }
                }

                $centerLatitude = $latitude;
                $centerLongitude = $longitude;

                $map = new Map();
                $map->setPrefixJavascriptVariable('map_');
                $map->setHtmlContainerId('map_canvas');
                $map->setAsync(false);
                $map->setCenter($centerLatitude, $centerLongitude, true);
                $map->setMapOption('zoom', 3);
                $map->setMapOption('mapTypeId', MapTypeId::ROADMAP);
                $map->setMapOption('disableDefaultUI', true);
                $map->setMapOption('disableDoubleClickZoom', true);
                $map->setMapOptions(array(
                    'disableDefaultUI' => true,
                    'disableDoubleClickZoom' => true,
                ));
                $map->setStylesheetOptions(array(
                    'width' => 'auto',
                    'height' => '300px',
                ));
                $map->setLanguage('en');

                // Add the spots to the map
                foreach ($markers as $marker) {
                    $map->addMarker($marker);
                }
            }

//            //ir buscar ids das melhores fotografias
//            $p = $this->getDoctrine()->getRepository("SkaphandrusAppBundle:SkSpecies")
//                    ->getPhotosForIdentification($species->getId(), 0, 7);
//            //para cada id ir buscar o object
//            foreach ($p as $key => $ph) {
//                $photo = $this->getDoctrine()->getRepository("SkaphandrusAppBundle:SkPhoto")->findOneById($ph['id']);
//                $photos[] = $photo;
//            }
//
//
//
            //ir bucar photo com species_id = species_id and is_primary = 1
            $photoPrimary = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')
                    ->isPrimaryPhoto($species->getId());

            $species->setPrimaryPhoto($photoPrimary);

            //ir buscar especies da mesma ordem
            $species_ids = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')
                    ->findSpeciesInOrder($species, 10);

            //para cada especie ir buscar a melhor fotografia(devolve array)
            foreach ($species_ids as $key => $id) {
                $bestPhotos = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')
                        ->getPhotosForIdentification($id['id'], null, 1);

                $similarSpecies[] = $this->getDoctrine()
                        ->getRepository("SkaphandrusAppBundle:SkPhoto")
                        ->findOneById($bestPhotos[0]['id']);
            }

//            //ir buscar a lista de id de criterios da especie
//            $criterias_ids = $this->getDoctrine()->getRepository("SkaphandrusAppBundle:SkIdentificationCriteria")->getCriteriasFromSpecies($species->getId());
//
//            //ir buscar os criterios e todos os caracteres do criterio
//            foreach ($criterias_ids as $key => $criteria) {
//                $criterias[] = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkIdentificationCriteria')->findCriteriaJoinAllCharacters($criteria);
//            }
//
//            foreach ($criterias as $key => $criteria) :
//                foreach ($criteria->getCharacters() as $key => $character):
//                    $isFromSpecies = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')->isCharacterFromSpecies($species->getId(), $character->getId());
//                    $character->setIsFromSpecies($isFromSpecies);
//                endforeach;
//            endforeach;

            return $this->render('SkaphandrusAppBundle:Default:species.html.twig', array(
                        "species" => $species,
                        "similarSpecies" => $similarSpecies,
                        "spots" => $spots,
                        'map' => $map,
                        'map_center_lat' => $centerLatitude,
                        'map_center_lon' => $centerLongitude
//                        "photos" => $photos,
//                        "criterias" => $criterias,
//                        "allCriterias" => $allCriterias
//                        "users" => $users
            ));
        } else {
            throw $this->createNotFoundException('The species ' . $species . ' does not exist.');
        }
    }

    /*
     * Users Home page
     */

    public function usersHomeAction() {

        $em = $this->get('doctrine.orm.entity_manager');
        $dql = "SELECT u FROM SkaphandrusAppBundle:SkUserResults u join SkaphandrusAppBundle:FosUser f WITH u.id = f.id order by u.photos desc";
        $query = $em->createQuery($dql);

        $paginator = $this->get('knp_paginator');
        $pagination = $paginator->paginate(
                $query, $this->get('request')->query->getInt('page', 1)/* page number */, 10/* limit per page */
        );

        // parameters to template
        return $this->render('SkaphandrusAppBundle:Default:users-home.html.twig', array(
                    'pagination' => $pagination,
        ));
    }

    public function business_no_slugAction($id) {

        $business = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkBusiness')
                ->find($id);

        return $this->redirect($this->generateUrl('business', array('country' => Utils::slugify($business->getAddress()->getLocation()->getRegion()->getCountry()),
                            'location' => Utils::slugify($business->getAddress()->getLocation()),
                            'slug' => Utils::slugify($business->getName()))));
    }

    /*
     * Business Page
     */

    public function businessAction($country, $location, $slug) {

        $em = $this->getDoctrine()->getManager();

        $locale = $this->get('request')->getLocale();
        $business = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkBusiness')
                ->findBySlug($country, $location, $slug, $locale);

        if ($business) {

            $photosCount = $em->createQuery('SELECT count(p.id) FROM SkaphandrusAppBundle:SkPhoto p WHERE p.business = ?1')->setParameter(1, $business->getId())->getSingleScalarResult();
            $speciesCount = $em->createQuery('SELECT COUNT(DISTINCT(p.species)) FROM SkaphandrusAppBundle:SkPhoto p WHERE p.business = ?1')->setParameter(1, $business->getId())->getSingleScalarResult();
            $photographersCount = $em->createQuery('SELECT COUNT(DISTINCT(p.fosUser)) FROM SkaphandrusAppBundle:SkPhoto p WHERE p.business = ?1')->setParameter(1, $business->getId())->getSingleScalarResult();

            $map = null;
            $latitude = 0;
            $longitude = 0;
            $centerLatitude = 0;
            $centerLongitude = 0;

            //$business = new \Skaphandrus\AppBundle\Entity\SkBusiness();
            if ($business->getAddress()->getCoordinate() != null) {

                if (count($business->getAddress()->getLocation()) > 0) {

                    try {

                        // Get markers from spots for the map
                        $markers = array();
                        $marker = new Marker();

                        //remove white spaces
                        $latitude = preg_replace('/\s+/', '', explode(",", $business->getAddress()->getCoordinate())[0]);
                        $longitude = preg_replace('/\s+/', '', explode(",", $business->getAddress()->getCoordinate())[1]);
                        $zoom = $business->getAddress()->getZoom();

                        $infowindow = new InfoWindow();
                        if ($business->getAddress()->getStreet()) {
                            $contentString = $business->getName() . '
 ' . $business->getAddress()->getStreet() . ', ' . $business->getAddress()->getLocation()->getName() . ', ' . $business->getAddress()->getLocation()->getRegion()->getCountry();
                        } else {
                            $contentString = $business->getName() . '
 ' . $business->getAddress()->getLocation()->getName() . ', ' . $business->getAddress()->getLocation()->getRegion()->getCountry();
                        }
                        $infowindow->setContent($contentString);
                        $infowindow->setOption('maxWidth', 250);

                        // Marker options
                        $marker->setInfoWindow($infowindow);
                        $marker->setPrefixJavascriptVariable('marker_');
                        $marker->setPosition($latitude, $longitude, true);
                        $marker->setAnimation(Animation::DROP);
                        $marker->setOption('clickable', true);
                        $marker->setOption('flat', true);
                        $marker->setOptions(array(
                            'clickable' => true,
                            'flat' => true,
                        ));

                        // $totalLatitude += $latitude;
                        // $totalLongitude += $longitude;
                        $markers[] = $marker;
                    } catch (OverlayException $ex) {
                        //erro coordenada mal ex: 37.0"a"5846492309772, -8.3441162109375
                    } catch (InvalidParameterException $ex) {
                        //erro da constraução do url
                    }
                }

                $centerLatitude = $latitude;
                $centerLongitude = $longitude;

                $map = new Map();
                $map->setPrefixJavascriptVariable('map_');
                $map->setHtmlContainerId('map_canvas');
                $map->setAsync(false);
                $map->setCenter($centerLatitude, $centerLongitude, true);
                $map->setMapOption('zoom', intval($zoom));
                $map->setMapOption('mapTypeId', MapTypeId::ROADMAP);
                $map->setMapOption('disableDefaultUI', true);
                $map->setMapOption('disableDoubleClickZoom', true);
                $map->setMapOptions(array(
                    'disableDefaultUI' => true,
                    'disableDoubleClickZoom' => true,
                ));
                $map->setStylesheetOptions(array(
                    'width' => 'auto',
                    'height' => '300px',
                ));
                $map->setLanguage('en');

                // Add the spots to the map
                foreach ($markers as $marker) {
                    $map->addMarker($marker);
                }
            }

            $mapSpot = null;
            $latitudeSpot = 0;
            $longitudeSpot = 0;
            $centerLatitudeSpot = 0;
            $centerLongitudeSpot = 0;

            if (count($business->getSpot()) > 0) {

                // Get markers from spots for the map
                $markersSpot = array();
                // $totalLatitude = 0;
                // $totalLongitude = 0;
                foreach ($business->getSpot() as $spot) {

                    //dump($spot->getCoordinate());

                    if ($spot->getCoordinate()) {

                        try {
                            $markerSpot = new Marker();

                            //remove white spaces
                            $latitudeSpot = preg_replace('/\s+/', '', explode(",", $spot->getCoordinate())[0]);
                            $longitudeSpot = preg_replace('/\s+/', '', explode(",", $spot->getCoordinate())[1]);

                            $infowindow = new InfoWindow();

                            //$utils = new \Skaphandrus\AppBundle\Twig\UtilsExtension($this->container, $this->get('translator'));
                            //$contentString = $utils->link_to_spot($spot->getName(), $spot->getLocation(), $spot->getLocation()->getRegion()->getCountry());
                            //$contentString = $spot->getName();
                            $spot_url = $this->generateUrl('spot', array(
                                'slug' => $spot->getName(),
                                'location' => $spot->getLocation(),
                                'country' => $spot->getLocation()->getRegion()->getCountry()
                            ));

                            $contentString = "" . $spot->getName() . "";

                            $infowindow->setContent($contentString);
                            $infowindow->setAutoClose(TRUE);

                            // Marker options
                            $markerSpot->setInfoWindow($infowindow);
                            $markerSpot->setPrefixJavascriptVariable('marker_spot_');
                            $markerSpot->setPosition($latitudeSpot, $longitudeSpot, true);
                            $markerSpot->setAnimation(Animation::DROP);
                            $markerSpot->setOption('clickable', true);
                            $markerSpot->setOption('flat', true);
                            $markerSpot->setOptions(array(
                                'clickable' => true,
                                'flat' => true,
                            ));

                            // $totalLatitude += $latitudeSpot;
                            // $totalLongitude += $longitudeSpot;
                            $markersSpot[] = $markerSpot;
                        } catch (OverlayException $ex) {
                            //erro coordenada mal ex: 37.0"a"5846492309772, -8.3441162109375
                        } catch (InvalidParameterException $ex) {
                            //erro da constraução do url
                        }
                    }
                }

                // Create the map
                // $centerLatitudeSpot = $totalLatitude / count($markersSpot);
                // $centerLongitudeSpot = $totalLongitude / count($markersSpot);
                // $centerLatitudeSpot = explode(",", $location->getSpots()->toArray()[0]->getCoordinate())[0];
                // $centerLongitudeSpot = explode(",", $location->getSpots()->toArray()[0]->getCoordinate())[1];

                $centerLatitudeSpot = $latitudeSpot;
                $centerLongitudeSpot = $longitudeSpot;

                $mapSpot = new Map();
                $mapSpot->setPrefixJavascriptVariable('map_spot_');
                $mapSpot->setHtmlContainerId('map_canvas_spot');
                $mapSpot->setAsync(false);
                $mapSpot->setCenter($centerLatitudeSpot, $centerLongitudeSpot, true);
                $mapSpot->setMapOption('zoom', 10);
                $mapSpot->setMapOption('mapTypeId', MapTypeId::ROADMAP);
                $mapSpot->setMapOption('disableDefaultUI', true);
                $mapSpot->setMapOption('disableDoubleClickZoom', true);
                $mapSpot->setMapOptions(array(
                    'disableDefaultUI' => true,
                    'disableDoubleClickZoom' => true,
                ));
                $mapSpot->setStylesheetOptions(array(
                    'width' => 'auto',
                    'height' => '300px',
                ));
                $mapSpot->setLanguage('en');

                // Add the spots to the map
                foreach ($markersSpot as $markerSpot) {
                    $mapSpot->addMarker($markerSpot);
                }
            }

//            $map = $this->getMapAddress($business);
//            $mapSpot = $this->getMapSpots($business);

            return $this->render('SkaphandrusAppBundle:Default:business.html.twig', array(
                        'business' => $business,
                        'photosCount' => $photosCount,
                        'speciesCount' => $speciesCount,
                        'photographersCount' => $photographersCount,
                        'map' => $map,
                        'mapSpot' => $mapSpot,
            ));
        } else {
            throw $this->createNotFoundException('The business "' . $slug . '" does not exist in the location ' . $location . ' or country ' . $country);
        }
    }

    /*
     * Destinations page
     */

    public function destinationsAction() {
//
        $continents = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkContinent')
                ->findAll();

//        $continent = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkContinent')
//                ->find(6);
//
//        $country = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkCountry')
//                ->find(166);

        foreach ($continents as $continent) {
            $countries = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkCountry')
                    ->findCountriesWithSpots($continent->getId());
            $continent->setCountries($countries);
        }

        return $this->render('SkaphandrusAppBundle:Default:destinations.html.twig', array(
                    'continents' => $continents
        ));
    }

    /*
     * Spot Page
     */

    public function spotAction($country, $location, $slug) {
        $locale = $this->get('request')->getLocale();
        $spot = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpot')
                ->findBySlug($slug, $location, $country, $locale);

        $spot->setPhotosInSpot(count($spot->getPhotos()));
        $spot->setPhotos($this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpot')->findPhotosSpot($spot->getId()));

        $diveCenters = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkBusiness')
                ->findDiveCentersInSpot($spot->getId());

        $liveaboards = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkBusiness')
                ->findLiveaboardsInSpot($spot->getId());

        $accommodations = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkBusiness')
                ->findAccommodationsInSpot($spot->getId());

////        photos
//        $qb_photos = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhoto')->getQueryBuilder(['spot' => $spot], 20);
//        $query_photos = $qb_photos->getQuery();
//        $photos = $query_photos->getResult();
////        photographers
//        $qb_photographers = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:FosUser')->getQueryBuilder(['spot' => $spot], 20);
//        $query_photographers = $qb_photographers->getQuery();
//        $photographers = $query_photographers->getResult();
//
//        $species = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')
//                ->findSpeciesInSpot($spot->getId());
//
//        $photographers = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:FosUser')
//                ->findUsersInSpot($spot->getId());
//
////        species
//        $qb_species = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')->getQueryBuilder(['spot' => $spot], 20);
//        $query_species = $qb_species->getQuery();
//        $species = $query_species->getResult();
//
//        $photos_count = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')->countPhotosSpotArray($spot->getId());
//        foreach ($species as $specie) {
//            if (isset($photos_count[$specie->getId()])) {
//                $specie->setPhotosCount($photos_count[$specie->getId()]);
//            }
//        }

        $map = null;
        $latitude = 0;
        $longitude = 0;
        $centerLatitude = 0;
        $centerLongitude = 0;

        if (count($spot->getLocation()->getSpots()) > 0) {

            // Get markers from spots for the map
            $markers = array();

            foreach ($spot->getLocation()->getSpots() as $s) {

                //dump($spot->getCoordinate());

                if ($s->getCoordinate()) {

                    try {

                        $marker = new Marker();

                        //remove white spaces
                        $latitude = preg_replace('/\s+/', '', explode(",", $s->getCoordinate())[0]);
                        $longitude = preg_replace('/\s+/', '', explode(",", $s->getCoordinate())[1]);

                        $infowindow = new InfoWindow();
                        $s_url = $this->generateUrl('spot', array(
                            'slug' => $s->getName(),
                            'location' => $s->getLocation(),
                            'country' => $s->getLocation()->getRegion()->getCountry()
                        ));

                        $contentString = "" . $s->getName() . "";

                        $infowindow->setContent($contentString);
                        $infowindow->setAutoClose(TRUE);

                        // Marker options

                        if ($spot == $s):
                            $marker->setIcon('http://maps.google.com/mapfiles/marker_green.png');
                        else:
                            $marker->setIcon('http://maps.google.com/mapfiles/marker.png');
                        endif;

                        $marker->setInfoWindow($infowindow);
                        $marker->setPrefixJavascriptVariable('marker_');
                        $marker->setPosition($latitude, $longitude, true);
                        $marker->setAnimation(Animation::DROP);
                        $marker->setOption('clickable', true);
                        $marker->setOption('flat', true);
                        $marker->setOptions(array(
                            'clickable' => true,
                            'flat' => true,
                        ));

                        $markers[] = $marker;
                    } catch (OverlayException $ex) {
                        //erro coordenada mal ex: 37.0"a"5846492309772, -8.3441162109375
                    } catch (InvalidParameterException $ex) {
                        //erro da constraução do url
                    }
                }
            }

            $centerLatitude = $latitude;
            $centerLongitude = $longitude;

            $map = new Map();
            $map->setPrefixJavascriptVariable('map_');
            $map->setHtmlContainerId('map_canvas');
            $map->setAsync(false);
            $map->setCenter($centerLatitude, $centerLongitude, true);
            $map->setMapOption('zoom', 10);
            $map->setMapOption('mapTypeId', MapTypeId::ROADMAP);
            $map->setMapOption('disableDefaultUI', true);
            $map->setMapOption('disableDoubleClickZoom', true);
            $map->setMapOptions(array(
                'disableDefaultUI' => true,
                'disableDoubleClickZoom' => true,
            ));
            $map->setStylesheetOptions(array(
                'width' => 'auto',
                'height' => '300px',
            ));
            $map->setLanguage('en');

            // Add the spots to the map
            foreach ($markers as $marker) {
                $map->addMarker($marker);
            }
        }

        if ($spot) {
            return $this->render('SkaphandrusAppBundle:Default:spot.html.twig', array(
                        'spot' => $spot,
                        'map' => $map,
                        'diveCenters' => $diveCenters,
                        'liveaboards' => $liveaboards,
                        'accommodations' => $accommodations,
//                        'photographers' => $photographers,
//                        'species' => $species,
            ));
        } else {
            throw $this->createNotFoundException('The spot ' . $spot . ' does not exist.');
        }
    }

    /*
     * Location page.
     */

    public function locationAction($country, $slug) {
        $name = Utils::unslugify($slug);
        $locale = $this->get('request')->getLocale();

        $em = $this->getDoctrine()->getManager();
        $location = $em->getRepository('SkaphandrusAppBundle:SkLocation')
                ->findBySlug($name, $country, $locale);

        if ($location) {

            $diveCenters = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkBusiness')
                    ->findDiveCentersInLocation($location->getId());

            $liveaboards = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkBusiness')
                    ->findLiveaboardsInLocation($location->getId());

            $accommodations = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkBusiness')
                    ->findAccommodationsInLocation($location->getId());

//            photographers
//            $qb_photographers = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:FosUser')->getQueryBuilder(['location' => $location], 20);
//            $query_photographers = $qb_photographers->getQuery();
//            $photographers = $query_photographers->getResult();
//
//            $spots = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpot')
//                    ->findSpotsInLocation($location->getId(), $locale);
//
//            $species = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')
//                    ->findSpeciesInLocation($location->getId());
//
//            $photographers = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:FosUser')
//                    ->findUsersInLocation($location->getId());
//            //species
//            $qb_species = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')->getQueryBuilder(['location' => $location], 20);
//            $query_species = $qb_species->getQuery();
//            $species = $query_species->getResult();
//
//            $photos_count = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')->countPhotosLocationArray($location->getId());
//            foreach ($species as $specie) {
//                if (isset($photos_count[$specie->getId()])) {
//                    $specie->setPhotosCount($photos_count[$specie->getId()]);
//                }
//            }

            $map = null;
            $latitude = 0;
            $longitude = 0;
            $centerLatitude = 0;
            $centerLongitude = 0;

            if (count($location->getSpots()) > 0) {

                // Get markers from spots for the map
                $markers = array();
                // $totalLatitude = 0;
                // $totalLongitude = 0;
                foreach ($location->getSpots() as $spot) {

                    //dump($spot->getCoordinate());

                    if ($spot->getCoordinate()) {

                        try {

                            $marker = new Marker();

                            //remove white spaces
                            $latitude = preg_replace('/\s+/', '', explode(",", $spot->getCoordinate())[0]);
                            $longitude = preg_replace('/\s+/', '', explode(",", $spot->getCoordinate())[1]);

                            $infowindow = new InfoWindow();
                            //$utils = new \Skaphandrus\AppBundle\Twig\UtilsExtension($this->container, $this->get('translator'));
                            //$contentString = $utils->link_to_spot($spot->getName(), $spot->getLocation(), $spot->getLocation()->getRegion()->getCountry());
                            //$contentString = $spot->getName();
                            $spot_url = $this->generateUrl('spot', array(
                                'slug' => $spot->getName(),
                                'location' => $spot->getLocation(),
                                'country' => $spot->getLocation()->getRegion()->getCountry()
                            ));

                            $contentString = "" . $spot->getName() . "";

                            $infowindow->setContent($contentString);
                            $infowindow->setAutoClose(TRUE);

                            // Marker options
                            $marker->setInfoWindow($infowindow);
                            $marker->setPrefixJavascriptVariable('marker_');
                            $marker->setPosition($latitude, $longitude, true);
                            $marker->setAnimation(Animation::DROP);
                            $marker->setOption('clickable', true);
                            $marker->setOption('flat', true);
                            $marker->setOptions(array(
                                'clickable' => true,
                                'flat' => true,
                            ));

                            // $totalLatitude += $latitude;
                            // $totalLongitude += $longitude;
                            $markers[] = $marker;
                        } catch (OverlayException $ex) {
                            //erro coordenada mal ex: 37.0"a"5846492309772, -8.3441162109375
                        } catch (InvalidParameterException $ex) {
                            //erro da constraução do url
                        }
                    }
                }

                // Create the map
                // $centerLatitude = $totalLatitude / count($markers);
                // $centerLongitude = $totalLongitude / count($markers);
//                $centerLatitude = explode(",", $location->getSpots()->toArray()[0]->getCoordinate())[0];
//                $centerLongitude = explode(",", $location->getSpots()->toArray()[0]->getCoordinate())[1];

                $centerLatitude = $latitude;
                $centerLongitude = $longitude;

                $map = new Map();
                $map->setPrefixJavascriptVariable('map_');
                $map->setHtmlContainerId('map_canvas');
                $map->setAsync(false);
                $map->setCenter($centerLatitude, $centerLongitude, true);
                $map->setMapOption('zoom', 10);
                $map->setMapOption('mapTypeId', MapTypeId::ROADMAP);
                $map->setMapOption('disableDefaultUI', true);
                $map->setMapOption('disableDoubleClickZoom', true);
                $map->setMapOptions(array(
                    'disableDefaultUI' => true,
                    'disableDoubleClickZoom' => true,
                ));
                $map->setStylesheetOptions(array(
                    'width' => 'auto',
                    'height' => '300px',
                ));
                $map->setLanguage('en');

                // Add the spots to the map
                foreach ($markers as $marker) {
                    $map->addMarker($marker);
                }
            }

            return $this->render('SkaphandrusAppBundle:Default:location.html.twig', array(
                        'location' => $location,
                        'map' => $map,
                        'map_center_lat' => $centerLatitude,
                        'map_center_lon' => $centerLongitude,
                        'diveCenters' => $diveCenters,
                        'liveaboards' => $liveaboards,
                        'accommodations' => $accommodations,
//                        'spots' => $spots,
//                        'photographers' => $photographers,
//                        'species' => $species,
            ));
        } else {
            throw $this->createNotFoundException('The location ' . $name . ' does not exist.');
        }
    }

    /*
     * Country page.
     */

    public function countryAction($slug) {
        $name = Utils::unslugify($slug);
        $locale = $this->get('request')->getLocale();
        $country = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkCountry')
                ->findBySlug($slug, $locale);

//        dump($country);

        if ($country) {

            $diveCenters = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkBusiness')
                    ->findDiveCentersInCountry($country->getId());

            $liveaboards = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkBusiness')
                    ->findLiveaboardsInCountry($country->getId());

            $accommodations = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkBusiness')
                    ->findAccommodationsInCountry($country->getId());

//            $locations = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkLocation')
//                    ->findLocationsInCountry($country->getId(), $locale);
//
//            $species = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')
//                    ->findSpeciesInCountry($country->getId());
//
//            $photographers = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:FosUser')
//                    ->findUsersInCountry($country->getId());
//
//            $spots_count = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkLocation')
//                ->countSpotsArray();
//            $photos_count = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkLocation')
//                ->countPhotosArray();
//
//            foreach ($locations as $location) {
//                if (isset($spots_count[$location->getId()])) {
//                    $location->setSpotsCount($spots_count[$location->getId()]);
//                }
//                if (isset($photos_count[$location->getId()])) {
//                    $location->setPhotosCount($photos_count[$location->getId()]);
//                }
//            }
//
//            //species
//            $qb_species = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')->getQueryBuilder(['location' => $location], 20);
//            $query_species = $qb_species->getQuery();
//            $species = $query_species->getResult();
//
//            $photos_count = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')->countPhotosCountryArray($country->getId());
//            foreach ($species as $specie) {
//                if (isset($photos_count[$specie->getId()])) {
//                    $specie->setPhotosCount($photos_count[$specie->getId()]);
//                }
//            }

            return $this->render('SkaphandrusAppBundle:Default:country.html.twig', array(
                        'country' => $country,
                        'country_name' => $name,
                        'diveCenters' => $diveCenters,
                        'liveaboards' => $liveaboards,
                        'accommodations' => $accommodations
//                        'locations' => $locations,
//                        'species' => $species,
//                        'photographers' => $photographers,
            ));
        } else {
            throw $this->createNotFoundException('The country ' . $name . ' does not exist.');
        }
    }

    /*
     * Locations Home page
     */

    public function locationsHomeAction() {

        $countries = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkCountry')
                ->findAllWithSpots();
        $spots = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkCountry')
                ->countSpotsArray();
        $photos = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkCountry')
                ->countPhotosArray();

        foreach ($countries as $country) {
            if (isset($spots[$country->getName()])) {
                $country->setSpotsCount($spots[$country->getName()]);
            }
            if (isset($photos[$country->getName()])) {
                $country->setPhotosCount($photos[$country->getName()]);
            }
        }

        return $this->render('SkaphandrusAppBundle:Default:locations-home.html.twig', array(
                    'countries' => $countries,
        ));
    }

    /*
     * Photo page.
     */

    public function photoAction($id, $slug = null) {
        $title = Utils::unslugify($slug);

        $next_photo_id = $id;
        $previous_photo_id = $id;

        $next_photo = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhoto')
                ->findNextPhoto($id);
        if ($next_photo):
            $next_photo_id = $next_photo->getId();
        endif;

        $previous_photo = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhoto')
                ->findPreviousPhoto($id);
        if ($previous_photo):
            $previous_photo_id = $previous_photo->getId();
        endif;

        $photo = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhoto')
                ->findOneById($id);

        $em = $this->getDoctrine()->getManager();

        $photosUser = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhoto')
                ->getPhotosFromUser($photo->getFosUser());

//        $photoInContest = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhoto')
//                ->getPhotoInContest($photo->getId()/* 24078 */, $locale);

        if ($photo) {
            $securityContext = $this->container->get('security.context');

            //set species is user dont set, but we have sugestion or validation
            if (!$photo->getSpecies()) {
                if (count($photo->getSpeciesValidations()) > 0) {
                    $photo->setSpecies($photo->getSpeciesValidations()[0]->getSpecies());
                    $em->persist($photo);
                    $em->flush();
                } elseif (count($photo->getSpeciesSugestions()) > 0) {
                    $photo->setSpecies($photo->getSpeciesSugestions()[0]->getSpecies());
                    $em->persist($photo);
                    $em->flush();
                }
            }

            // Check for validations
            $validations = $this->getDoctrine()->getManager()->createQuery(
                            'SELECT IDENTITY(sv.species), count(sv.species) AS validation_count
              FROM SkaphandrusAppBundle:SkPhotoSpeciesValidation sv
              WHERE IDENTITY(sv.photo) = :id
              GROUP BY sv.species
              ORDER BY validation_count DESC'
                    )->setParameter('id', $id)->getResult();

            $validationCount = 0;
            if (isset($validations[0])) {
                $validationCount = $validations[0]['validation_count'];
            }

            $showValidation = $securityContext->isGranted('ROLE_EXPERT') && $validationCount < 3;

            // Check if validation is new or not
            $validationAction = 'new';
            $userValidation = NULL;
            if ($showValidation) {
                $userValidation = $this->getDoctrine()
                        ->getRepository('SkaphandrusAppBundle:SkPhotoSpeciesValidation')
                        ->findOneBy(array(
                    'fosUser' => $this->get('security.token_storage')->getToken()->getUser(),
                    'photo' => $photo,
                ));

                if ($userValidation) {
                    $validationAction = 'edit';
                }
            }

            $showSugestion = $securityContext->isGranted('IS_AUTHENTICATED_FULLY') && !$securityContext->isGranted('ROLE_EXPERT') && count($photo->getSpeciesSugestions()) < 10;

            // Check if sugestion is new or not
            $sugestionAction = 'new';
            $userSugestion = NULL;
            if ($showSugestion) {
                $userSugestion = $this->getDoctrine()
                        ->getRepository('SkaphandrusAppBundle:SkPhotoSpeciesSugestion')
                        ->findOneBy(array(
                    'fosUser' => $this->get('security.token_storage')->getToken()->getUser(),
                    'photo' => $photo,
                ));

                if ($userSugestion) {
                    $sugestionAction = 'edit';
                }
            }

            $views = $photo->getViews() + 1;
            $photo->setViews($views);
            $em->persist($photo);
            $em->flush();

            $loggeduser = $this->get('security.token_storage')->getToken()->getUser();

            $votedPhoto = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhotoContestVote')
                    ->findOneBy(array('fosUser' => $loggeduser, 'category' => "behaviour"));

            //$photo = new \Skaphandrus\AppBundle\Entity\SkPhoto();

            foreach ($photo->getCategory() as $category):

                //atribuir numero de pontos dos juizes
                $category->setPointsInPhoto($this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhoto')->setPoints($photo->getId(), $category->getId()));

                //atribuir a fotografia votada pelo utilizador na categoria
//            $category->setVotedInPhoto($this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhoto')->setPoints($photo->getId(), $category->getId()));
//
//
            endforeach;

            return $this->render('SkaphandrusAppBundle:Default:photo.html.twig', array(
                        'photo' => $photo,
                        'previous_photo' => $previous_photo_id,
                        'next_photo' => $next_photo_id,
                        'photosUser' => $photosUser,
//                        'photoInContest' => $photoInContest,
                        'votedPhoto' => $votedPhoto,
                        'showValidation' => $showValidation,
                        'showSugestion' => $showSugestion,
                        'validationAction' => $validationAction,
                        'userValidation' => $userValidation,
                        'sugestionAction' => $sugestionAction,
                        'userSugestion' => $userSugestion
//                'categories' => $categories
            ));
        } else {
            throw $this->createNotFoundException('The photo "' . $title . '" with id "' . $id . '" does not exist.');
        }
    }

    /*
     * Photo page.
     */

//    public function photosAction() {
//        $page = $this->get('request')->query->get('page');
//        if (!$page) { $page = 1; }
//
//        $per_page = 20;
//        $photos = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhoto')
//            ->findAllAsPaginator($page, $per_page);
//
//        // Variables for pagination
//        $visible_pages = 9;
//        $total_pages = ceil(count($photos) / $per_page);
//
//        // If current page number is less than half of visible pages in the begining...
//        if ($page < floor($visible_pages / 2)) {
//            $first_page = 1;
//            $last_page = $visible_pages;
//        }
//        // If current page number is less than half of visible pages in the end...
//        elseif ($page > $total_pages - floor($visible_pages / 2)) {
//            $last_page = $total_pages;
//            $first_page = $total_pages - $visible_pages;
//        }
//        // If current page is not close to the limit edges...
//        else {
//            $first_page = $page - floor($visible_pages / 2);
//            $last_page = $page + floor($visible_pages / 2);
//        }
//
//        return $this->render('SkaphandrusAppBundle:Default:photos.html.twig', array(
//            'photos' => $photos,
//            'pagination' => array(
//                'page' => $page,
//                'total_pages' => ceil(count($photos) / $per_page),
//                'first_page' => $first_page,
//                'last_page' => $last_page,
//            ),
//        ));
//    }

    public function photosAction(Request $request) {

        $locale = $this->get('request')->getLocale();
//        $params = $request->request->get('skaphandrus_filter_gallery');
        $params = [];

        $form = $this->createForm(new \Skaphandrus\AppBundle\Form\SkFilterGalleryType(), array(
            'action' => 'POST',
            'method' => 'PUT',
        ));
        $form->handleRequest($request);

        $sort = $this->get('translator')->trans('page.photos.label.best');

        // 1) verificar se é post
        if ($this->getRequest()->isMethod('POST')):

            //1.1 passar todos os parametros para $params
            if ($form->get('fosUser')->getData()) {
                $params['fosUser'] = $form->get('fosUser')->getData()->getId();
            }
            if ($form->get('spotName')->getData()) {
                $params['spotName'] = $form->get('spotName')->getData();
            }
            if ($form->get('location')->getData()) {
                $params['location'] = $form->get('location')->getData()->getId();
            }
            if ($form->get('region')->getData()) {
                $params['region'] = $form->get('region')->getData()->getId();
            }
            if ($form->get('countryName')->getData()) {
                $params['countryName'] = $form->get('countryName')->getData();
            }
            if ($form->get('vernacular')->getData()) {
                $params['vernacular'] = $form->get('vernacular')->getData();
            }
            if ($form->get('species')->getData()) {
                $params['species'] = $form->get('species')->getData()->getId();
            }
            if ($form->get('genus')->getData()) {
                $params['genus'] = $form->get('genus')->getData()->getId();
            }
            if ($form->get('family')->getData()) {
                $params['family'] = $form->get('family')->getData()->getId();
            }
            if ($form->get('order')->getData()) {
                $params['order'] = $form->get('order')->getData()->getId();
            }
            if ($form->get('class')->getData()) {
                $params['class'] = $form->get('class')->getData()->getId();
            }
            if ($form->get('phylum')->getData()) {
                $params['phylum'] = $form->get('phylum')->getData()->getId();
            }
            if ($form->get('kingdom')->getData()) {
                $params['kingdom'] = $form->get('kingdom')->getData()->getId();
            }

            //1.2 redirect
            return $this->redirect($this->generateUrl('photos', $params));

        //vem por get
        else:
            $params = $request->query->all();
            if (array_key_exists('sort', $params)) {
                if ($params['sort'] == "p.validatedRating") {
                    $sort = $this->get('translator')->trans('page.photos.label.best');
                } elseif ($params['sort'] == "p.id") {
                    $sort = $this->get('translator')->trans('page.photos.label.id');
                }
            }
        endif;

        $qb = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhoto')->getQueryBuilderForGallery($locale, $params, 30);

//        //se o resultado da query for NULL vai buscar as photos todas
//        if ($qb->getQuery()->getResult() == null) {
//            $params = [];
//            $qb = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhoto')->getQueryBuilderForGallery($locale, $params, 30);
//        }

        $paginator = $this->get('knp_paginator');
        $pagination = $paginator->paginate(
                $qb, $this->get('request')->query->getInt('page', 1)/* page number */, 30/* limit per page */, array('defaultSortFieldName' => 'p.validatedRating', 'defaultSortDirection' => 'DESC')
        );

//        dump($params);

        $objs = new \stdClass();

        foreach ($params as $key => $value) {
            if ($key != 'sort' and $key != 'direction' and $key != 'page' and $key != 'fosUser'):
                $objs->{$key} = $this->getDoctrine()->getRepository("SkaphandrusAppBundle:Sk" . ucfirst($key))->find($value);
            elseif ($key == 'fosUser'):
                $objs->{$key} = $this->getDoctrine()->getRepository("SkaphandrusAppBundle:" . ucfirst($key))->find($value);
//                elseif ($key == 'vernacular'):
//                $objs->{$key} = $this->getDoctrine()->getRepository("SkaphandrusAppBundle:SkSpecies" . ucfirst($key))->find($value);
            endif;
        }

//        dump($objs);

        return $this->render('SkaphandrusAppBundle:Default:photos.html.twig', array(
                    'pagination' => $pagination,
                    'params' => $params,
                    'objs' => $objs,
                    'sort' => $sort,
                    'form' => $form->createView(),
        ));
    }

    /*
     * User page.
     */

    public function userAction($id) {

        $locale = $this->get('request')->getLocale();
        $friends = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPerson')->findByFosUser($id);

        //$user = new FosUser();

        $user = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:FosUser')
                ->findOneById($id);

//        $species = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')
//                ->findSpeciesInUser($user->getId());

        $spots = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpot')
                ->findSpotsInUser($user->getId(), $locale);
//
//        $validations = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:FosUser')
//                ->getUserValidations($user->getId());
//
//        $sugestions = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:FosUser')
//                ->getUserSugestions($user->getId());

        $acquisitions = $user->getModules();

        $em = $this->getDoctrine()->getManager();

        $photosCount = $em->createQuery('SELECT COUNT(p.id) FROM SkaphandrusAppBundle:SkPhoto p WHERE p.fosUser = ?1')->setParameter(1, $id)->getSingleScalarResult();
        $tagsCount = 0;
        $speciesCount = $em->createQuery('SELECT COUNT(DISTINCT(p.species)) FROM SkaphandrusAppBundle:SkPhoto p WHERE p.fosUser = ?1')->setParameter(1, $id)->getSingleScalarResult();
        $spotsCount = $em->createQuery('SELECT COUNT(DISTINCT(p.spot)) FROM SkaphandrusAppBundle:SkPhoto p WHERE p.fosUser = ?1')->setParameter(1, $id)->getSingleScalarResult();
        $friendsCount = $em->createQuery('SELECT COUNT(p.id) FROM SkaphandrusAppBundle:SkPerson p WHERE p.fosUser = ?1')->setParameter(1, $id)->getSingleScalarResult();
        $modulesCount = count($acquisitions);
        $pointsCount = $user->getSettings()->getPoints();
        $validationsCount = $em->createQuery('SELECT COUNT(v.id) FROM SkaphandrusAppBundle:SkPhotoSpeciesValidation v WHERE v.fosUser = ?1')->setParameter(1, $id)->getSingleScalarResult();
        $suggestionsCount = $em->createQuery('SELECT COUNT(s.id) FROM SkaphandrusAppBundle:SkPhotoSpeciesSugestion s WHERE s.fosUser = ?1')->setParameter(1, $id)->getSingleScalarResult();

        $map = null;
        $latitude = 0;
        $longitude = 0;
//        $centerLatitude = 0;
//        $centerLongitude = 0;

        if (count($spots) > 0) {

            // Get markers from spots for the map
            $markers = array();

            foreach ($spots as $spot) {

                //dump($spot->getCoordinate());
                if ($spot->getCoordinate()) {

                    try {

                        $marker = new Marker();

                        //remove white spaces
                        $latitude = preg_replace('/\s+/', '', explode(",", $spot->getCoordinate())[0]);
                        $longitude = preg_replace('/\s+/', '', explode(",", $spot->getCoordinate())[1]);

                        $infowindow = new InfoWindow();
                        $spot_url = $this->generateUrl('spot', array(
                            'slug' => $spot->getName(),
                            'location' => $spot->getLocation(),
                            'country' => $spot->getLocation()->getRegion()->getCountry()
                        ));

                        $contentString = "" . $spot->getName() . "";

                        $infowindow->setContent($contentString);
                        $infowindow->setAutoClose(TRUE);

                        // Marker options
                        $marker->setInfoWindow($infowindow);
                        $marker->setPrefixJavascriptVariable('marker_');
                        $marker->setPosition($latitude, $longitude, true);
                        $marker->setAnimation(Animation::DROP);
                        $marker->setOption('clickable', true);
                        $marker->setOption('flat', true);
                        $marker->setOptions(array(
                            'clickable' => true,
                            'flat' => true,
                        ));

                        $markers[] = $marker;
                    } catch (OverlayException $ex) {
                        //erro coordenada mal ex: 37.0"a"5846492309772, -8.3441162109375
                    } catch (InvalidParameterException $ex) {
                        //erro da constraução do url
                    }
                }
            }

            // Create the map
//            $centerLatitude = $latitude;
//            $centerLongitude = $longitude;

            $map = new Map();
            $map->setPrefixJavascriptVariable('map_');
            $map->setHtmlContainerId('map_canvas');
            $map->setAsync(false);
            $map->setCenter(40, 0, true);
            $map->setMapOption('zoom', 3);
//            $map->setCenter($centerLatitude, $centerLongitude, true);
//            $map->setMapOption('zoom', 10);
            $map->setMapOption('mapTypeId', MapTypeId::ROADMAP);
            $map->setMapOption('disableDefaultUI', true);
            $map->setMapOption('disableDoubleClickZoom', true);
            $map->setMapOptions(array(
                'disableDefaultUI' => true,
                'disableDoubleClickZoom' => true,
            ));
            $map->setStylesheetOptions(array(
                'width' => 'auto',
                'height' => '300px',
            ));
            $map->setLanguage('en');

            // Add the spots to the map
            foreach ($markers as $marker) {
                $map->addMarker($marker);
            }
        }

        if ($user) {
            return $this->render('SkaphandrusAppBundle:Default:user.html.twig', array(
                        'user' => $user,
                        'friends' => $friends,
                        //'spots' => $spots,
                        'map' => $map,
                        'acquisitions' => $acquisitions,
                        'photosCount' => $photosCount,
                        'tagsCount' => $tagsCount,
                        'speciesCount' => $speciesCount,
                        'spotsCount' => $spotsCount,
                        'friendsCount' => $friendsCount,
                        'modulesCount' => $modulesCount,
                        'pointsCount' => $pointsCount,
                        'validationsCount' => $validationsCount,
                        'suggestionsCount' => $suggestionsCount,
            ));
        } else {
            throw $this->createNotFoundException('The user with id "' . $id . '" does not exist.');
        }
    }

    // ############################# COMPONENTS #############################

    /*
     * Prints a board of photos.
     *
     * Include these files on the page:
     * <link rel="stylesheet" href="{{ asset('bundles/skaphandrusapp/css/plugins/blueimp/css/blueimp-gallery.min.css') }}">
     *
     */
//    public function skBoardAction($parameters, $limit = 20, $order = array('id' => 'desc')) {
//        $qb = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhoto')->getQueryBuilder($parameters, $limit, $order);
////        $query = $qb->getQuery();
////        $photos = $query->getResult();
//
//        $photos = $qb->getResult();
//
//        return $this->render('SkaphandrusAppBundle:Default:skBoard.html.twig', array(
//                    'photos' => $photos,
//                    'parameters' => $parameters,
//        ));
//    }

    /*
     * Prints a grid of photos.
     *
     * Include these files on the page:
     * <link rel="stylesheet" href="{{ asset('bundles/skaphandrusapp/css/plugins/blueimp/css/blueimp-gallery.min.css') }}">
     *
     */

    public function skGridAction($parameters, $limit, $order = array('id' => 'desc')) {

        // ini_set('memory_limit', '64M');

        $locale = $this->get('request')->getLocale();

        if (isset($parameters['photos'])) {
            $photos = $parameters['photos'];
            unset($parameters['photos']);
        } else {
            $conn = $this->get('database_connection');

            $sql = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhoto')
                    ->getQueryForGrid($parameters, $limit, $order, 0, $locale);
            $photos = $conn->fetchAll($sql);
        }

        return $this->render('SkaphandrusAppBundle:Default:skGrid.html.twig', array(
                    'photos' => $photos,
                    'parameters' => $parameters,
        ));
    }

    public function searchAction(Request $request) {
        $string = $request->query->get('string');
        $locale = $request->getLocale();
        //$translator = new Translator($locale);

        $results = array();

        // Search Species
        $speciesSN = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')
                ->findScientificNameSearchResults($string, $locale);

        foreach ($speciesSN as $s) {
            $results[] = array(
                'title' => $s['title'] . ' (' . $this->get('translator')->trans('page.search.label.species') . ')',
                'url' => $this->generateUrl('species', array('slug' => Utils::slugify($s['title'])), true),
                'desc' => $s['description'],
            );
        }

        // Search Families
        $familySN = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkFamily')
                ->findLikeName($string);

        foreach ($familySN as $f) {
            $results[] = array(
                'title' => $f->getName() . ' (' . $this->get('translator')->trans('page.search.label.family') . ')',
                'url' => $this->generateUrl('taxon', array(
                    'node' => 'family',
                    'slug' => Utils::slugify($f->getName())
                        ), true),
                'desc' => '',
            );
        }

        // Search Orders
        $orderSN = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkOrder')
                ->findLikeName($string);

        foreach ($orderSN as $f) {
            $results[] = array(
                'title' => $f->getName() . ' (' . $this->get('translator')->trans('page.search.label.order') . ')',
                'url' => $this->generateUrl('taxon', array(
                    'node' => 'order',
                    'slug' => Utils::slugify($f->getName())
                        ), true),
                'desc' => '',
            );
        }

        // Search Spots
        $spots = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpot')
                ->findSearchResults($string, $locale);

        foreach ($spots as $s) {
            $country_name = Intl::getRegionBundle()->getCountryName($s['country_name']);
            $results[] = array(
                'title' => $s['title'] . ' (' . $this->get('translator')->trans('page.search.label.spot') . ')',
                'url' => $this->generateUrl('spot', array(
                    'country' => Utils::slugify($country_name),
                    'location' => Utils::slugify($s['location_name']),
                    'slug' => Utils::slugify($s['title']),
                        ), true),
                'desc' => $s['description'],
            );
        }

        // Search Locations
        $locations = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkLocation')
                ->findSearchResults($string, $locale);

        foreach ($locations as $l) {
            $country_name = Intl::getRegionBundle()->getCountryName($l['country_name']);
            $results[] = array(
                'title' => $l['title'] . ' (' . $this->get('translator')->trans('page.search.label.location') . ')',
                'url' => $this->generateUrl('location', array(
                    'country' => Utils::slugify($country_name),
                    'slug' => Utils::slugify($l['title']),
                        ), true),
                'desc' => $l['description'],
            );
        }

        // Search Photos
        $photos = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPhoto')
                ->findLikeName($string);

        foreach ($photos as $photo) {
            $results[] = array(
                'title' => $photo['title'] . ' (' . $this->get('translator')->trans('page.search.label.photo') . ')',
                'url' => $this->generateUrl('photo', array(
                    'id' => $photo['id'],
                    'slug' => Utils::slugify($photo['title']),
                        ), true),
                'desc' => $photo['description'],
            );
        }

        $users = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkPersonal')
                ->findLikeName($string);

        foreach ($users as $u) {
            $fosUser = $u->getFosUser();
            $results[] = array(
                'title' => $u->getName() . ' (' . $this->get('translator')->trans('page.search.label.user') . ')',
                'url' => $this->generateUrl('user', array(
                    'id' => $fosUser->getId(),
                    'username' => $fosUser->getUsername(),
                        ), true),
                'desc' => '',
            );
        }

        // $speciesV = $this->getDoctrine()->getRepository('SkaphandrusAppBundle:SkSpecies')
        //     ->findVernacularSearchResults($string, $locale);
        // foreach ($speciesV as $s) {
        //     $names = $s['object']->getScientificNames();
        //     $slug = Utils::slugify($names[0]->getName());
        //     $results[] = array(
        //         'title' => $s['title'],
        //         'url' => $this->generateUrl('species', array('slug' => $slug)),
        //         'desc' => $s['description'],
        //     );
        // }

        return $this->render('SkaphandrusAppBundle:Default:search.html.twig', array(
                    'string' => $string,
                    'results' => $results,
        ));
    }

}


text:
<?php

class ui_tpl_domainname {

    public static function Template() {
        $domain = str_replace('www.', '', $_SERVER['HTTP_HOST']);
        return $domain;
    }

}

?>


text:
describe('Styleguidist core', () => {
	beforeEach(() => cy.visit('/'));

	it('loads the page', () => {
		cy.title().should('include', 'React Styleguidist');
	});

	it('shows multiple components in normal mode', () => {
		cy.get('[id$=container]').should('have.length.above', 1);
	});

	it('shows single component in isolated mode', () => {
		cy.get('a[aria-label="Open isolated"]')
			.first()
			.click();
		cy.get('[id$=container]').should('have.length', 1);
	});
});


text:
package org.oliot.heroku.tsd.models.schema;

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

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

 * <complexType name="ConsignmentIdentificationType">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="ginc" type="{urn:gs1:shared:shared_common:xsd:3}GINCType"/>
 *         <element name="additionalConsignmentIdentification" type="{urn:gs1:shared:shared_common:xsd:3}AdditionalConsignmentIdentificationType" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ConsignmentIdentificationType", namespace = "urn:gs1:shared:shared_common:xsd:3", propOrder = {
    "ginc",
    "additionalConsignmentIdentification"
})
public class ConsignmentIdentificationType {

    @XmlElement(required = true)
    protected String ginc;
    protected List<AdditionalConsignmentIdentificationType> additionalConsignmentIdentification;

    /**
     * Gets the value of the ginc property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getGinc() {
        return ginc;
    }

    /**
     * Sets the value of the ginc property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setGinc(String value) {
        this.ginc = value;
    }

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

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

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

     *    getAdditionalConsignmentIdentification().add(newItem);
     *

     *
     *
     *

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

}


text:
class VariableScope_06

  @instance_var = 'instance_var'

  def self.instance_var
    @instance_var
  end

  def self.instance_var=(value)
    @instance_var = value
  end

end


text:
"""
Utilities used in testing of Orca.

"""
import numpy as np
import numpy.testing as npt
import pandas as pd

def assert_frames_equal(actual, expected, use_close=False):
    """
    Compare DataFrame items by index and column and
    raise AssertionError if any item is not equal.

    Ordering is unimportant, items are compared only by label.
    NaN and infinite values are supported.

    Parameters
    ----------
    actual : pandas.DataFrame
    expected : pandas.DataFrame
    use_close : bool, optional
        If True, use numpy.testing.assert_allclose instead of
        numpy.testing.assert_equal.

    """
    if use_close:
        comp = npt.assert_allclose
    else:
        comp = npt.assert_equal

    assert (isinstance(actual, pd.DataFrame) and
            isinstance(expected, pd.DataFrame)), \
        'Inputs must both be pandas DataFrames.'

    for i, exp_row in expected.iterrows():
        assert i in actual.index, 'Expected row {!r} not found.'.format(i)

        act_row = actual.loc[i]

        for j, exp_item in exp_row.iteritems():
            assert j in act_row.index, \
                'Expected column {!r} not found.'.format(j)

            act_item = act_row[j]

            try:
                comp(act_item, exp_item)
            except AssertionError as e:
                raise AssertionError(
                    str(e) + '\n\nColumn: {!r}\nRow: {!r}'.format(j, i))

def assert_index_equal(left, right):
    """
    Similar to pdt.assert_index_equal but is not sensitive to key ordering.

    Parameters
    ----------
    left: pandas.Index
    right: pandas.Index
    """
    assert isinstance(left, pd.Index)
    assert isinstance(right, pd.Index)
    left_diff = left.difference(right)
    right_diff = right.difference(left)
    if len(left_diff) > 0 or len(right_diff) > 0:
        raise AssertionError("keys not in left [{0}], keys not in right [{1}]".format(
            left_diff, right_diff))


text:
class Order < ApplicationRecord
  belongs_to :organization
  belongs_to :organization_unscoped, -> { unscope(where: :deleted_at) },
             class_name: "Organization",
             foreign_key: :organization_id
  belongs_to :user
  has_many :order_details, autosave: true
  has_many :order_program_details, autosave: true
  has_many :items, through: :order_details
  has_many :tracking_details

  include OrderStatus

  def self.by_status_includes_extras(statuses, include_tables = %i[organization order_details tracking_details])
    statuses = [statuses].flatten.map { |s| Order.statuses[s] }
    includes(*include_tables).where(status: statuses)
  end

  def unscoped_organization
    @unscoped_organization ||= Organization.unscoped { organization }
  end

  def add_tracking_details(params)
    params[:order][:tracking_details][:tracking_number].each_with_index do |tracking_number, index|
      shipping_carrier = params[:order][:tracking_details][:shipping_carrier][index]
      tracking_details.build(
        date: Time.zone.now,
        tracking_number: tracking_number,
        shipping_carrier: shipping_carrier.to_i
      )
    end
  end

  def sync_status_available?
    external_id.present?
  end

  def synced?
    external_id.present? && !NetSuiteIntegration.export_failed?(self)
  end

  def formatted_order_date
    order_date.strftime("%-m/%-d/%Y") if order_date.present?
  end

  def submitted?
    !select_items? && !select_ship_to? && !confirm_order?
  end

  def open?
    !(closed? || rejected? || canceled?)
  end

  def order_uneditable?
    filled? || shipped? || received? || closed? || rejected? || canceled?
  end

  def ship_to_addresses
    organization.addresses.map(&:address)
  end

  def ship_to_names
    [user.name.to_s, "#{organization.name} c/o #{user.name}"]
  end

  def organization_ship_to_names
    organization.users.map do |user|
      [user.name.to_s, "#{organization.name} c/o #{user.name}"]
    end.flatten
  end

  def to_json
    {
      id: id,
      status: status,
      order_details: order_details.sort_by(&:id).map(&:to_json),
      in_requested_status: in_requested_status?
    }.to_json
  end

  def self.to_json
    includes(:order_details).order(:id).all.map(&:to_json).to_json
  end

  def value
    order_details.map(&:total_value).sum
  end

  def item_count
    order_details.map(&:quantity).sum
  end

  def create_values_for_programs
    transaction do
      program_values = Hash.new { |h, k| h[k] = 0.0 }

      order_details.each do |detail|
        ratios = detail.item.program_ratio_split_for(organization_unscoped.programs)

        ratios.each do |program, ratio|
          program_values[program] += detail.total_value * ratio
        end
      end

      program_values.each do |program, value|
        order_program_details.create!(program: program, value: value)
      end
    end
  end

  def value_by_program
    order_program_details.all.each_with_object({}) do |detail, result|
      result[detail.program] = detail.value
      result
    end
  end
end


text:
var connect = require('../');

var fixtures = __dirname + '/fixtures';

var app = connect();
app.use(connect.staticCache());
app.use(connect.static(fixtures, { maxAge: Infinity }));

describe('connect.staticCache()', function(){
  it('should set X-Cache to MISS when missed', function(done){
    app.request()
    .get('/todo.txt')
    .expect('X-Cache', 'MISS', done);
  })

  it('should set Age', function(done){
    app.request()
    .get('/todo.txt')
    .end(function(res){
      res.should.have.header('age');
      done();
    });
  })

  it('should set X-Cache to MISS end-to-end', function(done){
    app.request()
    .get('/todo.txt')
    .set('Cache-Control', 'no-cache')
    .expect('X-Cache', 'MISS', done);
  })

  it('should set X-Cache to HIT when hit', function(done){
    app.request()
    .get('/todo.txt')
    .expect('X-Cache', 'HIT', done);
  })

  it('should set X-Cache to MISS when query changes', function(done){
    app.request()
    .get('/todo.txt?_=1234')
    .expect('X-Cache', 'MISS', done);
  })

  it('should retain header fields', function(done){
    app.request()
    .get('/todo.txt')
    .end(function(res){
      res.should.have.header('content-type', 'text/plain; charset=UTF-8');
      res.should.have.header('content-length', '11');
      done();
    });
  })

  it('should serve the contents on GET', function(done){
    app.request()
    .get('/todo.txt')
    .expect('- groceries', done);
  })

  it('should not serve the contents on HEAD', function(done){
    app.request()
    .head('/todo.txt')
    .expect('', done);
  })

  it('should retain Content-Length on HEAD', function(done){
    app.request()
    .head('/todo.txt')
    .expect('Content-Length', '11', done);
  })

  it('should not cache private', function(done){
    var app = connect();
    app.use(connect.staticCache());
    app.use(function(req, res, next){
      res.setHeader('Cache-Control', 'private');
      next();
    });
    app.use(connect.static(fixtures), { maxAge: Infinity });

    app.request()
    .head('/todo.txt')
    .expect('X-Cache', 'MISS', done);
  })

  it('should not cache no-store', function(done){
    var app = connect();
    app.use(connect.staticCache());
    app.use(function(req, res, next){
      res.setHeader('Cache-Control', 'no-store');
      next();
    });
    app.use(connect.static(fixtures), { maxAge: Infinity });

    app.request()
    .head('/todo.txt')
    .expect('X-Cache', 'MISS', done);
  })
})


text:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="latest_ob.xsl" type="text/xsl"?>
<current_observation version="1.0"
	 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	 xsi:noNamespaceSchemaLocation="http://www.weather.gov/view/current_observation.xsd">
	<credit>NOAA's National Weather Service</credit>
	<credit_URL>http://weather.gov/</credit_URL>
	<image>
		<url>http://weather.gov/images/xml_logo.gif</url>
		<title>NOAA's National Weather Service</title>
		<link>http://weather.gov</link>
	</image>
	<suggested_pickup>15 minutes after the hour</suggested_pickup>
	<suggested_pickup_period>60</suggested_pickup_period>
	<location>Unknown Station</location>
	<station_id>63105</station_id>
	<observation_time>Last Updated on Jan 4 2016, 10:00 pm AST</observation_time>
        <observation_time_rfc822>Mon, 04 Jan 2016 22:00:00 -0400</observation_time_rfc822>
	<temperature_string>36.9 F (2.7 C)</temperature_string>
	<temp_f>36.9</temp_f>
	<temp_c>2.7</temp_c>
	<wind_string>South at 11.4 MPH (9.91 KT)</wind_string>
	<wind_dir>South</wind_dir>
	<wind_degrees>180</wind_degrees>
	<wind_mph>11.4</wind_mph>
	<wind_gust_mph>0.0</wind_gust_mph>
	<wind_kt>9.91</wind_kt>
	<pressure_string>1003.3 mb</pressure_string>
	<pressure_mb>1003.3</pressure_mb>
	<pressure_tendency_mb>0.3</pressure_tendency_mb>
	<dewpoint_string>18.3 F (-7.6 C)</dewpoint_string>
	<dewpoint_f>18.3</dewpoint_f>
	<dewpoint_c>-7.6</dewpoint_c>
	<windchill_string>29 F (-2 C)</windchill_string>
      	<windchill_f>29</windchill_f>
      	<windchill_c>-2</windchill_c>
	<visibility_mi>27.00</visibility_mi>
	<mean_wave_dir>Northeast</mean_wave_dir>
	<mean_wave_degrees></mean_wave_degrees>
	<disclaimer_url>http://weather.gov/disclaimer.html</disclaimer_url>
	<copyright_url>http://weather.gov/disclaimer.html</copyright_url>
	<privacy_policy_url>http://weather.gov/notice.html</privacy_policy_url>
</current_observation>


text:
Meteor Blog Post, And Project Post with Boostrap template Stanley

>Iron Router
>account-password
>Account-ui
>bootstrap 3 twbs
>tsega:bootstrap3-datetimepicker