text:
<?php

namespace Gedmo\Translatable;

use Doctrine\Common\EventManager;
use Tool\BaseTestCaseORM;
use Doctrine\ORM\Query;
use Gedmo\Translatable\Query\TreeWalker\TranslationWalker;
use Translatable\Fixture\Article;
use Translatable\Fixture\Comment;

/**
 * These are tests for translation query walker
 *
 * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
 * @link http://www.gediminasm.org
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
class TranslationQueryWalkerTest extends BaseTestCaseORM
{
    const ARTICLE = 'Translatable\\Fixture\\Article';
    const COMMENT = 'Translatable\\Fixture\\Comment';
    const TRANSLATION = 'Gedmo\\Translatable\\Entity\\Translation';

    const TREE_WALKER_TRANSLATION = 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker';

    private $translatableListener;

    protected function setUp()
    {
        parent::setUp();

        $evm = new EventManager;
        $this->translatableListener = new TranslatableListener();
        $this->translatableListener->setTranslatableLocale('en_us');
        $this->translatableListener->setDefaultLocale('en_us');
        $evm->addEventSubscriber($this->translatableListener);

        $this->getMockSqliteEntityManager($evm);
        $this->populate();
    }

    /**
     * @test
     */
    function shouldHandleQueryCache()
    {
        $cache = new \Doctrine\Common\Cache\ArrayCache();
        $this->em
            ->getConfiguration()
            ->expects($this->any())
            ->method('getQueryCacheImpl')
            ->will($this->returnValue($cache))
        ;
        $dql = 'SELECT a FROM ' . self::ARTICLE . ' a';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);

        // array hydration
        $this->translatableListener->setTranslatableLocale('en_us');
        $result = $q->getArrayResult();
        $this->assertCount(1, $result);

        $q2 = clone $q;
        $q2->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);
        $result = $q->getArrayResult();
        $this->assertCount(1, $result);
    }

    public function testSubselectByTranslatedField()
    {
        $this->populateMore();
        $dql = 'SELECT a FROM ' . self::ARTICLE . ' a';
        $subSelect = 'SELECT a2.title FROM ' . self::ARTICLE . ' a2';
        $subSelect .= " WHERE a2.title LIKE '%ab%'";
        $dql .= " WHERE a.title IN ({$subSelect})";
        $dql .= ' ORDER BY a.title';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);

        // array hydration
        $this->translatableListener->setTranslatableLocale('en_us');
        $result = $q->getArrayResult();
        $this->assertCount(2, $result);
        $this->assertEquals('Alfabet', $result[0]['title']);
        $this->assertEquals('Cabbages', $result[1]['title']);
    }

    public function testSubselectStatements()
    {
        $this->populateMore();
        $dql = 'SELECT a FROM ' . self::ARTICLE . ' a';
        $subSelect = 'SELECT a2.id FROM ' . self::ARTICLE . ' a2';
        $subSelect .= " WHERE a2.title LIKE '%ab%'";
        $dql .= " WHERE a.id IN ({$subSelect})";
        $dql .= ' ORDER BY a.title';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);

        // array hydration
        $this->translatableListener->setTranslatableLocale('en_us');
        $result = $q->getArrayResult();
        $this->assertCount(2, $result);
        $this->assertEquals('Alfabet', $result[0]['title']);
        $this->assertEquals('Cabbages', $result[1]['title']);
    }

    public function testJoinedWithStatements()
    {
        $this->populateMore();
        $dql = 'SELECT a, c FROM ' . self::ARTICLE . ' a';
        $dql .= ' LEFT JOIN a.comments c WITH c.subject LIKE :lookup';
        $dql .= ' WHERE a.title LIKE :filter';
        $dql .= ' ORDER BY a.title';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);

        // array hydration
        $this->translatableListener->setTranslatableLocale('en_us');
        $q->setParameter('lookup', '%goo%');
        $q->setParameter('filter', 'Foo%');
        $result = $q->getArrayResult();

        $this->assertCount(1, $result);
        $this->assertEquals('Food', $result[0]['title']);
        $comments = $result[0]['comments'];
        $this->assertCount(1, $comments);
        $this->assertEquals('good', $comments[0]['subject']);
    }

    public function testSelectWithTranslationFallbackOnSimpleObjectHydration()
    {
        $this->em
            ->getConfiguration()
            ->expects($this->any())
            ->method('getCustomHydrationMode')
            ->with(TranslationWalker::HYDRATE_SIMPLE_OBJECT_TRANSLATION)
            ->will($this->returnValue('Gedmo\\Translatable\\Hydrator\\ORM\\SimpleObjectHydrator'));

        $dql = 'SELECT a FROM ' . self::ARTICLE . ' a';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);

        $this->translatableListener->setTranslatableLocale('ru_ru');
        $this->translatableListener->setTranslationFallback(false);

        // simple object hydration
        $this->startQueryLog();
        $result = $q->getResult(Query::HYDRATE_SIMPLEOBJECT);
        $this->assertEquals(1, $this->queryAnalyzer->getNumExecutedQueries());
        $this->assertEquals('', $result[0]->getTitle());
        $this->assertEquals('', $result[0]->getContent());

        $this->translatableListener->setTranslationFallback(true);
        $this->queryAnalyzer->cleanUp();
        $result = $q->getResult(Query::HYDRATE_SIMPLEOBJECT);
        $this->assertEquals(1, $this->queryAnalyzer->getNumExecutedQueries());
        //Default translation is en_us, so we expect the results in that locale
        $this->assertEquals('Food', $result[0]->getTitle());
        $this->assertEquals('about food', $result[0]->getContent());
    }

    public function testSelectWithTranslationFallbackOnArrayHydration()
    {
        $dql = 'SELECT a, c FROM ' . self::ARTICLE . ' a';
        $dql .= ' LEFT JOIN a.comments c';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);

        $this->translatableListener->setTranslatableLocale('ru_ru');
        $this->translatableListener->setTranslationFallback(false);

        // array hydration
        $this->startQueryLog();
        $result = $q->getArrayResult();
        $this->assertEquals(1, $this->queryAnalyzer->getNumExecutedQueries());
        $this->assertEquals('', $result[0]['title']);
        $this->assertEquals('', $result[0]['content']);

        $this->translatableListener->setTranslationFallback(true);
        $this->queryAnalyzer->cleanUp();
        $result = $q->getArrayResult();
        $this->assertEquals(1, $this->queryAnalyzer->getNumExecutedQueries());
        //Default translation is en_us, so we expect the results in that locale
        $this->assertEquals('Food', $result[0]['title']);
        $this->assertEquals('about food', $result[0]['content']);
    }

    public function testSelectWithOptionalFallbackOnSimpleObjectHydration()
    {
        $this->em
            ->getConfiguration()
            ->expects($this->any())
            ->method('getCustomHydrationMode')
            ->with(TranslationWalker::HYDRATE_SIMPLE_OBJECT_TRANSLATION)
            ->will($this->returnValue('Gedmo\\Translatable\\Hydrator\\ORM\\SimpleObjectHydrator'));

        $dql = 'SELECT a FROM ' . self::ARTICLE . ' a';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);

        $this->translatableListener->setTranslatableLocale('ru_ru');
        $this->translatableListener->setTranslationFallback(false);

        // simple object hydration
        $this->startQueryLog();
        $result = $q->getResult(Query::HYDRATE_SIMPLEOBJECT);
        $this->assertEquals(1, $this->queryAnalyzer->getNumExecutedQueries());
        $this->assertEquals('', $result[0]->getTitle());
        $this->assertEquals('John Doe', $result[0]->getAuthor()); // optional fallback is true,  force fallback
        $this->assertEquals(0, $result[0]->getViews());

        $this->translatableListener->setTranslationFallback(true);
        $this->queryAnalyzer->cleanUp();
        $result = $q->getResult(Query::HYDRATE_SIMPLEOBJECT);
        $this->assertEquals(1, $this->queryAnalyzer->getNumExecutedQueries());
        //Default translation is en_us, so we expect the results in that locale
        $this->assertEquals('Food', $result[0]->getTitle());
        $this->assertEquals('John Doe', $result[0]->getAuthor());
        $this->assertEquals(0, $result[0]->getViews()); // optional fallback is false,  thus no translation required
    }

    /**
     * @test
     */
    public function shouldBeAbleToUseInnerJoinStrategyForTranslations()
    {
        $dql = 'SELECT a FROM ' . self::ARTICLE . ' a';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);
        $q->setHint(TranslatableListener::HINT_INNER_JOIN, true);

        $this->translatableListener->setTranslatableLocale('ru_ru');
        $this->translatableListener->setTranslationFallback(false);

        // array hydration
        $result = $q->getArrayResult();
        $this->assertCount(0, $result);
    }

    /**
     * referres to issue #755
     * @test
     */
    public function shouldBeAbleToOverrideTranslationFallbackByHint()
    {
        $this->translatableListener->setTranslatableLocale('lt_lt');
        $this->translatableListener->setTranslationFallback(false);

        $dql = 'SELECT a FROM ' . self::ARTICLE . ' a';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);
        $q->setHint(TranslatableListener::HINT_TRANSLATABLE_LOCALE, 'undefined');
        $q->setHint(TranslatableListener::HINT_FALLBACK, true);

        // array hydration
        $result = $q->getArrayResult();
        $this->assertCount(1, $result);
        $this->assertEquals('Food', $result[0]['title']);

        // fallback false hint
        $q->setHint(TranslatableListener::HINT_FALLBACK, false);

        // array hydration
        $result = $q->getArrayResult();
        $this->assertCount(1, $result);
        $this->assertEquals(null, $result[0]['title']);

    }

    /**
     * @test
     */
    public function shouldBeAbleToOverrideTranslatableLocale()
    {
        $dql = 'SELECT a FROM ' . self::ARTICLE . ' a';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);
        $q->setHint(TranslatableListener::HINT_TRANSLATABLE_LOCALE, 'lt_lt');

        $this->translatableListener->setTranslatableLocale('ru_ru');
        $this->translatableListener->setTranslationFallback(false);

        // array hydration
        $result = $q->getArrayResult();
        $this->assertCount(1, $result);
        $this->assertEquals('Maistas', $result[0]['title']);
    }

    public function testSelectWithTranslationFallbackOnObjectHydration()
    {
        $this->em
            ->getConfiguration()
            ->expects($this->any())
            ->method('getCustomHydrationMode')
            ->with(TranslationWalker::HYDRATE_OBJECT_TRANSLATION)
            ->will($this->returnValue('Gedmo\\Translatable\\Hydrator\\ORM\\ObjectHydrator'));

        $dql = 'SELECT a FROM ' . self::ARTICLE . ' a';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);

        $this->translatableListener->setTranslatableLocale('ru_ru');
        $this->translatableListener->setTranslationFallback(false);

        // object hydration
        $this->startQueryLog();
        $result = $q->getResult();
        $this->assertEquals(1, $this->queryAnalyzer->getNumExecutedQueries());
        $this->assertEquals('', $result[0]->getTitle());
        $this->assertEquals('', $result[0]->getContent());

        $this->translatableListener->setTranslationFallback(true);
        $this->queryAnalyzer->cleanUp();
        $result = $q->getResult();
        $this->assertEquals(1, $this->queryAnalyzer->getNumExecutedQueries());
        //Default translation is en_us, so we expect the results in that locale
        $this->assertEquals('Food', $result[0]->getTitle());
        $this->assertEquals('about food', $result[0]->getContent());

        // test fallback hint
        $this->translatableListener->setTranslationFallback(false);
        $q->setHint(TranslatableListener::HINT_FALLBACK, 1);

        $result = $q->getResult();
        //Default translation is en_us, so we expect the results in that locale
        $this->assertEquals('Food', $result[0]->getTitle());
        $this->assertEquals('about food', $result[0]->getContent());

        // test fallback hint
        $this->translatableListener->setTranslationFallback(true);
        $q->setHint(TranslatableListener::HINT_FALLBACK, 0);

        $result = $q->getResult();
        //Default translation is en_us, so we expect the results in that locale
        $this->assertEquals('', $result[0]->getTitle());
        $this->assertEquals('', $result[0]->getContent());
    }

    public function testSelectCountStatement()
    {
        $dql = 'SELECT COUNT(a) FROM ' . self::ARTICLE . ' a';
        $dql .= ' WHERE a.title LIKE :title';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);

        $this->translatableListener->setTranslatableLocale('en_us');
        $q->setParameter('title', 'Foo%');
        $result = $q->getSingleScalarResult();
        $this->assertEquals(1, $result);

        $this->translatableListener->setTranslatableLocale('lt_lt');
        $q->setParameter('title', 'Mai%');
        $result = $q->getSingleScalarResult();
        $this->assertEquals(1, $result);

        $this->translatableListener->setTranslatableLocale('en_us');
        $q->setParameter('title', 'Mai%');
        $result = $q->getSingleScalarResult();
        $this->assertEquals(0, $result);
    }

    public function testSelectOrderedJoinedComponentTranslation()
    {
        $this->em
            ->getConfiguration()
            ->expects($this->any())
            ->method('getCustomHydrationMode')
            ->with(TranslationWalker::HYDRATE_OBJECT_TRANSLATION)
            ->will($this->returnValue('Gedmo\\Translatable\\Hydrator\\ORM\\ObjectHydrator'));

        $this->populateMore();
        $dql = 'SELECT a, c FROM ' . self::ARTICLE . ' a';
        $dql .= ' LEFT JOIN a.comments c';
        $dql .= ' ORDER BY a.title';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);

        // array hydration
        $this->translatableListener->setTranslatableLocale('en_us');
        $result = $q->getArrayResult();
        $this->assertCount(4, $result);
        $this->assertEquals('Alfabet', $result[0]['title']);
        $this->assertEquals('Cabbages', $result[1]['title']);
        $this->assertEquals('Food', $result[2]['title']);
        $this->assertEquals('Woman', $result[3]['title']);

        $this->translatableListener->setTranslatableLocale('lt_lt');
        $result = $q->getArrayResult();
        $this->assertCount(4, $result);
        $this->assertEquals('Alfabetas', $result[0]['title']);
        $this->assertEquals('Kopustai', $result[1]['title']);
        $this->assertEquals('Maistas', $result[2]['title']);
        $this->assertEquals('Moteris', $result[3]['title']);

        // object hydration
        $this->translatableListener->setTranslatableLocale('en_us');
        $result = $q->getResult();
        $this->assertCount(4, $result);
        $this->assertEquals('Alfabet', $result[0]->getTitle());
        $this->assertEquals('Cabbages', $result[1]->getTitle());
        $this->assertEquals('Food', $result[2]->getTitle());
        $this->assertEquals('Woman', $result[3]->getTitle());

        $this->translatableListener->setTranslatableLocale('lt_lt');
        $result = $q->getResult();
        $this->assertCount(4, $result);
        $this->assertEquals('Alfabetas', $result[0]->getTitle());
        $this->assertEquals('Kopustai', $result[1]->getTitle());
        $this->assertEquals('Maistas', $result[2]->getTitle());
        $this->assertEquals('Moteris', $result[3]->getTitle());
    }

    public function testSelectOrderedByTranslatableInteger()
    {
        // Given
        $this->populateMore();
        $dql = 'SELECT a.title, a.views FROM ' . self::ARTICLE . ' a';
        $dql .= ' ORDER BY a.views';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);

        // Test original
        $this->translatableListener->setTranslatableLocale('en_us');
        $result = $q->getArrayResult();
        array_walk($result, function($value, $key) use(&$result) {
            // Make each record be a "Title - Views" string
            $result[$key] = implode(" - ", $value);
        });
        $this->assertEquals(
            array("Alfabet - 1", "Food - 99", "Cabbages - 2222", "Woman - 3333"), $result,
            "Original of localizible integers should be sorted numerically"
        );

        $this->translatableListener->setTranslatableLocale('lt_lt');
        $result = $q->getArrayResult();
        array_walk($result, function($value, $key) use(&$result) {
            // Make each record be a "Title - Views" string
            $result[$key] = implode(" - ", $value);
        });
        $this->assertEquals(
            array("Moteris - 33", "Alfabetas - 111", "Maistas - 999", "Kopustai - 22222"), $result,
            "Localized integers should be sorted numerically"
        );
    }

    public function testSelectSecondJoinedComponentTranslation()
    {
        $this->em
            ->getConfiguration()
            ->expects($this->any())
            ->method('getCustomHydrationMode')
            ->with(TranslationWalker::HYDRATE_OBJECT_TRANSLATION)
            ->will($this->returnValue('Gedmo\\Translatable\\Hydrator\\ORM\\ObjectHydrator'));

        $dql = 'SELECT a, c FROM ' . self::ARTICLE . ' a';
        $dql .= ' LEFT JOIN a.comments c';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);

        // array hydration
        $this->translatableListener->setTranslatableLocale('en_us');
        $result = $q->getArrayResult();
        $this->assertCount(1, $result);
        $food = $result[0];
        $this->assertCount(6, $food);
        $this->assertEquals('Food', $food['title']);
        $this->assertEquals('about food', $food['content']);
        $comments = $food['comments'];
        $this->assertCount(2, $comments);
        $good = $comments[0];
        $this->assertCount(3, $good);
        $this->assertEquals('good', $good['subject']);
        $this->assertEquals('food is good', $good['message']);
        $bad = $comments[1];
        $this->assertCount(3, $bad);
        $this->assertEquals('bad', $bad['subject']);
        $this->assertEquals('food is bad', $bad['message']);

        $this->translatableListener->setTranslatableLocale('lt_lt');
        $result = $q->getArrayResult();
        $this->assertCount(1, $result);
        $food = $result[0];
        $this->assertCount(6, $food);
        $this->assertEquals('Maistas', $food['title']);
        $this->assertEquals('apie maista', $food['content']);
        $comments = $food['comments'];
        $this->assertCount(2, $comments);
        $good = $comments[0];
        $this->assertCount(3, $good);
        $this->assertEquals('geras', $good['subject']);
        $this->assertEquals('maistas yra geras', $good['message']);
        $bad = $comments[1];
        $this->assertCount(3, $bad);
        $this->assertEquals('blogas', $bad['subject']);
        $this->assertEquals('maistas yra blogas', $bad['message']);

        // object hydration
        $this->translatableListener->setTranslatableLocale('en_us');
        $result = $q->getResult();
        $this->assertCount(1, $result);
        $food = $result[0];
        $this->assertEquals('Food', $food->getTitle());
        $this->assertEquals('about food', $food->getContent());
        $comments = $food->getComments();
        $this->assertCount(2, $comments);
        $good = $comments[0];
        $this->assertEquals('good', $good->getSubject());
        $this->assertEquals('food is good', $good->getMessage());
        $bad = $comments[1];
        $this->assertEquals('bad', $bad->getSubject());
        $this->assertEquals('food is bad', $bad->getMessage());

        $this->translatableListener->setTranslatableLocale('lt_lt');
        $result = $q->getResult();
        $this->assertCount(1, $result);
        $food = $result[0];
        $this->assertEquals('Maistas', $food->getTitle());
        $this->assertEquals('apie maista', $food->getContent());
        $comments = $food->getComments();
        $this->assertCount(2, $comments);
        $good = $comments[0];
        $this->assertInstanceOf(self::COMMENT, $good);
        $this->assertEquals('geras', $good->getSubject());
        $this->assertEquals('maistas yra geras', $good->getMessage());
        $bad = $comments[1];
        $this->assertEquals('blogas', $bad->getSubject());
        $this->assertEquals('maistas yra blogas', $bad->getMessage());
    }

    public function testSelectSinglePartializedComponentTranslation()
    {
        $this->em
            ->getConfiguration()
            ->expects($this->any())
            ->method('getCustomHydrationMode')
            ->with(TranslationWalker::HYDRATE_OBJECT_TRANSLATION)
            ->will($this->returnValue('Gedmo\\Translatable\\Hydrator\\ORM\\ObjectHydrator'));

        $dql = 'SELECT a.title FROM ' . self::ARTICLE . ' a';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);

        // array hydration
        $this->translatableListener->setTranslatableLocale('en_us');
        $result = $q->getArrayResult();
        $this->assertCount(1, $result);
        $food = $result[0];
        $this->assertCount(1, $food);
        $this->assertEquals('Food', $food['title']);
        $this->translatableListener->setTranslatableLocale('lt_lt');
        $result = $q->getArrayResult();
        $this->assertCount(1, $result);
        $food = $result[0];
        $this->assertCount(1, $food);
        $this->assertEquals('Maistas', $food['title']);

        // object hydration
        $this->translatableListener->setTranslatableLocale('en_us');
        $result = $q->getResult();
        $this->assertCount(1, $result);
        $food = $result[0];
        $this->assertCount(1, $food);
        $this->assertEquals('Food', $food['title']);
        $this->translatableListener->setTranslatableLocale('lt_lt');
        $result = $q->getResult();
        $this->assertCount(1, $result);
        $food = $result[0];
        $this->assertCount(1, $food);
        $this->assertEquals('Maistas', $food['title']);
    }

    public function testSelectSingleComponentTranslation()
    {
        $this->em
            ->getConfiguration()
            ->expects($this->any())
            ->method('getCustomHydrationMode')
            ->with(TranslationWalker::HYDRATE_OBJECT_TRANSLATION)
            ->will($this->returnValue('Gedmo\\Translatable\\Hydrator\\ORM\\ObjectHydrator'));

        $dql = 'SELECT a FROM ' . self::ARTICLE . ' a';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);

        // array hydration
        $this->translatableListener->setTranslatableLocale('en_us');
        $result = $q->getArrayResult();
        $this->assertCount(1, $result);
        $food = $result[0];
        $this->assertCount(5, $food);
        $this->assertEquals('Food', $food['title']);
        $this->assertEquals('about food', $food['content']);
        $this->translatableListener->setTranslatableLocale('lt_lt');
        $result = $q->getArrayResult();
        $this->assertCount(1, $result);
        $food = $result[0];
        $this->assertCount(5, $food);
        $this->assertEquals('Maistas', $food['title']);
        $this->assertEquals('apie maista', $food['content']);

        // object hydration
        $this->translatableListener->setTranslatableLocale('en_us');
        $result = $q->getResult();
        $this->assertCount(1, $result);
        $food = $result[0];
        $this->assertInstanceOf(self::ARTICLE, $food);
        $this->assertEquals('Food', $food->getTitle());
        $this->assertEquals('about food', $food->getContent());

        $this->translatableListener->setTranslatableLocale('lt_lt');
        $result = $q->getResult();
        $this->assertCount(1, $result);
        $food = $result[0];
        $this->assertEquals('Maistas', $food->getTitle());
        $this->assertEquals('apie maista', $food->getContent());
    }

    /**
     * @group testSelectWithUnmappedField
     */
    public function testSelectWithUnmappedField()
    {
        $dql = 'SELECT a.title, count(a.id) AS num FROM ' . self::ARTICLE . ' a';
        $dql .= ' ORDER BY a.title';
        $q = $this->em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION);

        // array hydration
        $this->translatableListener->setTranslatableLocale('en_us');
        $result = $q->getArrayResult();
        $this->assertCount(1, $result);
        $this->assertEquals('Food', $result[0]['title']);
        $this->assertEquals(1, $result[0]['num']);
    }

    protected function getUsedEntityFixtures()
    {
        return array(
            self::ARTICLE,
            self::TRANSLATION,
            self::COMMENT
        );
    }

    private function populateMore()
    {
        $repo = $this->em->getRepository(self::ARTICLE);
        $commentRepo = $this->em->getRepository(self::COMMENT);

        $this->translatableListener->setTranslatableLocale('en_us');
        $alfabet = new Article;
        $alfabet->setTitle('Alfabet');
        $alfabet->setContent('hey wtf!');
        $alfabet->setViews(1);

        $woman = new Article;
        $woman->setTitle('Woman');
        $woman->setContent('i like them');
        $woman->setViews(3333);

        $cabbages = new Article;
        $cabbages->setTitle('Cabbages');
        $cabbages->setContent('where went the woman?');
        $cabbages->setViews(2222);

        $this->em->persist($alfabet);
        $this->em->persist($woman);
        $this->em->persist($cabbages);
        $this->em->flush();
        $this->em->clear();

        $this->translatableListener->setTranslatableLocale('lt_lt');
        $alfabet = $repo->find(2);
        $alfabet->setTitle('Alfabetas');
        $alfabet->setContent('ei wtf!');
        $alfabet->setViews(111);

        $woman = $repo->find(3);
        $woman->setTitle('Moteris');
        $woman->setContent('as megstu jas');
        $woman->setViews(33);

        $cabbages = $repo->find(4);
        $cabbages->setTitle('Kopustai');
        $cabbages->setContent('kur dingo moteris?');
        $cabbages->setViews(22222);

        $this->em->persist($alfabet);
        $this->em->persist($woman);
        $this->em->persist($cabbages);
        $this->em->flush();
        $this->em->clear();
    }

    private function populate()
    {
        $repo = $this->em->getRepository(self::ARTICLE);
        $commentRepo = $this->em->getRepository(self::COMMENT);

        $food = new Article;
        $food->setTitle('Food');
        $food->setContent('about food');
        $food->setAuthor('John Doe');
        $food->setViews(99);

        $goodFood = new Comment;
        $goodFood->setArticle($food);
        $goodFood->setMessage('food is good');
        $goodFood->setSubject('good');

        $badFood = new Comment;
        $badFood->setArticle($food);
        $badFood->setMessage('food is bad');
        $badFood->setSubject('bad');

        $this->em->persist($food);
        $this->em->persist($goodFood);
        $this->em->persist($badFood);
        $this->em->flush();
        $this->em->clear();

        $this->translatableListener->setTranslatableLocale('lt_lt');
        $food = $repo->find(1);
        $food->setTitle('Maistas');
        $food->setContent('apie maista');
        $food->setViews(999);

        $goodFood = $commentRepo->find(1);
        $goodFood->setArticle($food);
        $goodFood->setMessage('maistas yra geras');
        $goodFood->setSubject('geras');

        $badFood = $commentRepo->find(2);
        $badFood->setArticle($food);
        $badFood->setMessage('maistas yra blogas');
        $badFood->setSubject('blogas');

        $this->em->persist($food);
        $this->em->persist($goodFood);
        $this->em->persist($badFood);
        $this->em->flush();
        $this->em->clear();
    }
}

redpajama_set_name: RedPajamaGithub


text:
Home entertainment Kate Middleton and William with the family: Big outing with George and...
Kate Middleton and William with the family: Big outing with George and Charlotte in formal clothes
We are witnessing a major reunion of the British royal family this Tuesday, 29 March 2022. As Buckingham announced several months ago, a tribute party for Prince Philip was held at Westminster Abbey, London. Nearly 1,800 guests gathered to honor the memory of the Duke of Edinburgh, who died nearly a year ago, at the age of 99. Queen Elizabeth, whose arrival was uncertain until the last minute, was able to count on the support of her children, grandchildren and great-grandchildren for this emotionally rich event.
Just back from their official trip to the Caribbean, Prince William and Kate Middleton Wear darker, more formal clothes for this party. The Duke and Duchess of Cambridge arrived in Westminster around 12 noon, accompanied by two of their three children: Prince George (8) and Prince Princess Charlotte (6 years). The youngest, Prince Louis (3 years), certainly resided in Kensington with his nanny.
Unsurprisingly, Kate Middleton arrived in front of the religious monument, holding her daughter's hand: the 40-year-old Briton wore a new long black dress with white dots signed by Alessandra Rich, her favorite dress. designers. The look is completed with a straight-brim hat and a pair of black pumps. For their part, hand in hand, Prince William and his heir George were matched in their suits and ties.
Great royal encounter
And so the Cambridge family reunited with the rest of the royal family: Prince Charles and Camilla, Prince Edward, his wife, Countess Sophie of Wessex and their two children (Lady Louise Windsor and Viscount James), Princess Anne and her husband, accompanied by her children Peter and Zara, Prince Andrew the detractor and her daughters, Princesses Eugenie and Beatrice, who They attended as a married couple (see slideshow). As expected, only Prince Harry and Meghan Markle have appeared in their absence. In the end, the Sussexes didn't make the flight from California and shouldn't until their safety is restored by Scotland Yard…
See also Issa Rae será Spider-Woman en Spider-Man: into the spiderverse 2
Several crowned European presidents also made the trip to London for the ceremony: Felipe of Spain and his wife Queen Letizia, King Carl XVI Gustaf and Queen Silvia of Sweden, Philip and Mathilde of Belgium, Beatrix of the Bass, and his son King Willem-Alexander. And his wife, Queen Maxima… Everyone missed Prince Philip's funeral, which was held at a select committee last year in Windsor, because of the pandemic.
Elise Fraley
"Web specialist. Freelance coffee advocate. Reader. Subtly charming pop culture expert."
Previous articleEarly version of ray tracing spotted on Xbox Series • Eurogamer.de
Next article5 tips from Elon Musk to be more efficient
"Web specialist. Freelance coffee advocate. Reader. Subtly charming pop culture expert."
What happened to Almond Maria? From Ecuador denounced her for copying her YouTube channel
Sandra Echeverria accuses two actors of bullying her in Hollywood
Miss Marvel on Disney+: Will there be a season 2? – News series
Christian Nodal and Caso were caught kissing before a concert in...
'Let's Dance Kids' final – Szewczenko's daughter wins – TV
Light Foo fighters at night in Pa'l Norte

redpajama_set_name: RedPajamaCommonCrawl


The SIMA Awards is the name for the annual honors that the Surf Industry Manufacturers Association gives some of the most dynamic players of the surf industry. For most of its 15-year history, SIMA Awards have been dominated by the major brands in surf. But when the 15th Annual SIMA awards were presented on March 20, an independent brand, Seea, took some of the big honors.
The San Clemente, Calif.-based Seea won the awards for Women's Swim Brand of the Year and Breakout Brand of the Year. Seea also was nominated for Wetsuit of the Year and the Women's Marketing Campaign category. In a recent article in California Apparel News, Sean Smith, SIMA's executive director, said that Seea was the only small, independent, women's surf brand to be nominated for four categories in the awards show's history.
Other brands taking trophies for big categories included Vissla being honored with the Men's Apparel Brand of the Year, Billabong winning Men's Boardshort Brand of the Year and Billabong Women's winning Women's Apparel Brand of the Year.
Oceanside, Calif. shop Surf Ride won the competition for Retailer of the Year – West Coast. Wise Surfboards of San Francisco was honored with the SIMA Surf Shop Gold Wave Award for being in business for more than 50-years. It opened for business in 1968.
The Vissla brand won a trophy for Men's Apparel Brand of the Year.
Billabong Women's won Women's Apparel Brand of the Year.


text:
Q: How to fix degeneracy of the Nelder–Mead simplex in r I have a huge dataset with over 4000 companies and I have estimated a liquidity measure for these each 4000 companies. But liquidity is highly persistent and exihibits auto-correlation. In order to mitigate this autocorrelation problem each of the liquidity measure estimated for the company has to be trasformed by AR(2) process i.e. residuals of autoregressive model are used instead of actual values.
But when I estiamate the AR(2) with following code in r
AR<- data.frame(dfAR1, apply(dfAR1, 2, function(x) arima(x, order = c(2,0,0),optim.method="Nelder-Mead")$res))

I receive warning
 arima(x, order = c(2, 0, 0), optim.method = "Nelder-Mead") :
  possible convergence problem: optim gave code = 10

When I looked up in the manual it says:
"10
indicates degeneracy of the Nelder–Mead simplex"
I don't understand how bad this warning is for my estimations and how can I fix it.
I would really appreciate your help in this regard.

redpajama_set_name: RedPajamaStackExchange


Most scuba divers are taught certain habits and rituals in their entry-level courses, which they discard as small or insignificant details as soon as they graduate from students to qualified divers.
Although many of us choose not to maintain these simple habits, we shouldn't forget their importance.
You remember one of these — it's that irritating tube that hangs uselessly on the left side of your mask. The clip is often awkward and gets stuck in long hair. It usually floats around with either the mouthpiece or splashguard disrupting your field of vision. Sometimes a current jogs it and upsets your mask's seal, leaving you to clear your mask 50 times in as many minutes and surface with stinging eyes, red and puffy from the salt water.
Snorkels do serve a purpose though. Perhaps its most obvious use is to do some snorkeling before a dive while waiting for other divers to get into the water, or afterwards when waiting for the boat to come pick you up. They are especially handy to keep you from swallowing half the ocean when the surface is a bit choppy.
Snorkels are there to make you more comfortable on the surface, designed to allow you to complete skills like donning or removing your weight belt and gear in the water with greater ease.
Customers often tell me: "I wear my weight belt with a left-hand release because I am left-handed." Divers should wear their weight belts with a right-hand release to standardize it — in an emergency your buddy might have to remove your weights for you. A consistent right-hand release avoids confusion and saves time in a critical situation.
There is a fine line between outstanding customer service and independent, responsible diver behavior. Many dive centers prepare their customers' gear as part of good service, but in so doing, we are creating divers who become dependent on the dive staff to take responsibility for everything from putting baby shampoo in their masks, to setting up gear, and even to — quite literally — putting the fins on their feet. Check your own gear before you board; make sure your straps, clasps and computer are functional; and put on your own fins.
Usually the first thing that divers do upon reaching the surface, after removing their regulator, is to remove their mask. I used to do this all the time — until the first time I lost a mask. If you put your mask on your forehead, you run the risk of a wave knocking it off. Someone may also mistake you for a panicked diver and attempt to save you. Now, if you have a particularly attractive divemaster or instructor this might not be such a bad thing, as rescue breathing is almost always necessary.
Divers often believe that being over-weighted is better than not having enough, and this is true up to a point. When doing a deep dive it is especially important that you can maintain your depth for the safety stop at 15 feet. But it's equally important that you're not over-weighted. Adding more weight to get you down and keep you down leads to a less efficient and streamlined diving position. Proper buoyancy — without the extra lead — is a key to becoming a capable diver.
Diving is kind of like riding a bike: Once you are on it, and you've gained some momentum, the muscle memory returns and it starts to feel natural (or at least somewhat comfortable) again.
If it's been awhile since you went diving, refreshers are a great way to help you feel comfortable in the water again. A refresher will remind you of important dive theory and how to complete the most common skills. Taking a refresher means you won't spend the first 20 minutes of your dive getting used to breathing through your regulator again or playing around with your buoyancy. It makes your whole dive more relaxed and allows you to focus on why you're diving: to look at fish and have fun.


Patio Furniture Naples Elegant Outdoor Living The Finest In Outdoor Furniture – When you are searching for Patio Furniture Naples for design solutions or intend to remodel your house, you no question desired the most effective recommendation and can additionally broaden the solution for you. We will certainly give details regarding the Patio Furniture Naples Elegant Outdoor Living The Finest In Outdoor Furniture that could be the most effective choice for you.
Solutions in house style or interior overhaul existing ones occasionally can experience the varied issues. For that reason, we give the most effective option for your preferred house. We give an example of photo Patio Furniture Naples Elegant Outdoor Living The Finest In Outdoor Furniture photo high quality we pick online, and we provide it to you because it is very ideal and suitable for your set as a recommendation to address your complication in discovering instances of design that is best for your beautiful house. This photo is the most effective collection regarding Patio Furniture Naples we download correctly for you because we think you are unique.
Inning accordance with our Patio Furniture Naples Elegant Outdoor Living The Finest In Outdoor Furniture can be one of the most effective recommendations for the design of Furniture your house the most effective. If curious about discovering the very same photo regarding Patio Furniture Naples Elegant Outdoor Living The Finest In Outdoor Furniture, we recommend that you search more regarding category Furniture you will certainly get a great deal of recommendation in making what you desire, you can drill down further with the search function situated on top of this web page. On your devoted visitors of our internet site, we apologize if there is an error in the writing of this Patio Furniture Naples write-up due to lack of details we get. We claim many thanks already willing to visit our internet site.


text:
Tag Archives: Getty Images
TOM STODDART – Perspectives – EXHIBITION
Leave a comment Posted by oxfordschoolofphotography on November 11, 2013
Unique and powerful photographs by the celebrated Tom Stoddart reveal forty years of significant world events
A selection of captivating images from the multi-award winning photojournalist Tom Stoddart will go on display at White Cloth Gallery, Leeds this October. 'Perspectives' comprises many of Stoddart's greatest shots from his distinguished career, featuring some of the most important moments in world history such as the fall of the Berlin Wall, the election of Nelson Mandela as South Africa's first black president and the Siege of Sarajevo.
During his distinguished career Tom Stoddart has travelled to more than 50 countries and documented such historic events as the fall of the Berlin Wall, the Siege of Sarajevo and the election of Nelson Mandela as South Africa's first black president.
His acclaimed in-depth work on the HIV/AIDS pandemic blighting sub-Saharan Africa won the POY World Understanding Award in 2003. In the same year his pictures of British Royal Marines in combat, during hostilities in Iraq, was awarded the Larry Burrows Award for Exceptional War Photography. A year later his book iWITNESS was honoured as the best photography book published in the USA.
Now established as one of the world's most respected photojournalists, Stoddart works closely with Reportage by Getty Images to produce photo essays on the serious world issues of our time.
To view more of Tom's work please go to http://www.tomstoddart.com For more information on Perspectives visit http://www.78perspectives.co.uk
White Cloth Gallery
24-26 Aire Street
LS1 4HT
Black and White Photography, Exhibition, Photography Exhibitions	Berlin Wall, Getty Images, Leeds, Nelson Mandela, oxfordschoolofphotography.co.uk, photographersworkshop.co.uk, Siege of Sarajevo, South Africa, Tom Stoddart, White Cloth Gallery
10 Photography Grants and Scholarships for Amateurs and Professionals
Leave a comment Posted by oxfordschoolofphotography on February 8, 2013
The last thing from Lightstalking this time is an article by:
Jacob Maentz
I'm a freelance travel, culture and documentary photographer based in the Philippines. My passion lies in creating images that communicate a strong sense of place and cultural awareness in unique, challenging situations. You can see my work at www.jacobimages.com
For many of us photographers, whether hobbyists or professionals, there are times when additional resources are needed to continue or progress our work. Photography projects can be very time intensive and often require a lot of financial resources to see them to the end. I am a big believer in hard work, but without financial support our hard work can often go nowhere. One avenue of finding those financial resources is through photography grants or scholarships. I have complied a short list of ongoing photography grants and scholarships for those amateurs, students or working professionals. Again, this is a short list and there are many others out there if you search for them. Those listed below cover most all genera of photography, but most emphasis editorial, photojournalism and documentary.
Here are just two of the grants available, go to Lightstalking to catch the rest
Focus for Humanity (FFH):
FFH offers a Fellowship of up to US$5,000 for a non full-time photographer keen to focus on photography as a career and probably within the humanitarian or cultural field, but who needs that final push or help to overcome that last barrier that is stopping them turning full-time. The fellowship is awarded by means of a competitive portfolio review and an assessment of an online application form.
Getty Images:
Getty Images offers two types of grant. The first, Grants for Editorial Photography, is available to both professionals and students. Since 2005, they have awarded five Grants for Editorial Photography annually to professional photojournalists. Each grant provides $20,000, plus editorial, logistical and promotional support. They also award four student grants of $5,000 per year to photojournalism students at accredited schools. The second, Grants for Good, consists of two grants of $15,000 annually, to cover photographer, filmmaker and agency costs as they create compelling new imagery for the nonprofit of their choice.
Click Here: 10 Photography Grants and Scholarships for Amateurs and Professionals
Photography, Photography Competitions	documentary photography, Getty Images, Lightstalking, oxfordschoolofphotography.co.uk, photographersworkshop.co.uk, Photography, Photojournalism, Scholarship
Photography industry shows mass opposition to government copyright changes
Leave a comment Posted by oxfordschoolofphotography on January 11, 2013
More than 70 organisations representing photographers, agencies and picture libraries – from Associated Press, Getty Images, Magnum Photos to the Press Association, Reuters and Tate – have joined forces, urging Parliament to vote against proposed changes to UK copyright law, BJP can exclusively reveal……….."The reason why all these organisations came together is because these proposals to change the UK's copyright law will have a serious adverse impact on everybody in the visual creative industry," Serena Tierney, head of Intellectual Property at law firm Bircham Dyson Bell, tells BJP
This is not scare mongering, this law will have an impact on everyone who has ever uploaded an image and not placed meta-data and copyright information on the image. READ MORE HERE
Read more: http://www.bjp-online.com/british-journal-of-photography/news/2235856/photography-industry-shows-mass-opposition-to-government-copyright-changes#ixzz2HgzeWJp6
Subscribe to BJP and save money. Click here to save 29% today.
Photography	Associated Press, BJP, Getty Images, Intellectual property, Magnum Photos, Olivier Laurent, oxfordschoolofphotography.co.uk, Photograph, photographersworkshop.co.uk, Photography, Press Association, Reuters
Tom Stoddart's retrospective comes to London's South Bank
Leave a comment Posted by oxfordschoolofphotography on July 21, 2012
In the BJP we read about a retrospective of the work of Tom Stoddart
A child plays with pigeons among the ruins of Bhachau, India, one of the worst hit towns after the earthquake of 2001 struck the region of Gujarat. Image © Tom Stoddart/Getty Images.
Perspectives, a retrospective of Tom Stoddart's career, will be shown on the South Bank throughout the Olympic and Paralympic Games, from 25 July to 11 September.
Eimear Kelly speaks to Stoddart
"I thought it was a really good opportunity to have an exhibition when lots and lots of people are visiting the capital, and the idea was to put it in a place where there would be a huge footfall of people," Stoddart tells BJP.
More London on the South Bank will display 78 of Stoddart's black and white images, where his Eyewitness exhibition was held eight years ago.
Open 25 July – 11 September, throughout the Olympic and Paralympic Games.
Seventy-eight of Stoddart's signature black and white pictures will form a free, open-air display at More London Riverside, between City Hall and HMS Belfast.During his distinguished career Stoddart has travelled to more than 50 countries and documented such historic events as the fall of the Berlin Wall, the Siege of Sarajevo and the election of Nelson Mandela as South Africa's first black president.His acclaimed in-depth work on the HIV/AIDS pandemic blighting sub-Saharan Africa won the POY World Understanding Award in 2003. In the same year his pictures of British Royal Marines in combat, during hostilities in Iraq, was awarded the Larry Burrows Award for Exceptional War Photography. A year later his book iWITNESS was honoured as the best photography book published in the USA.Now established as one of the world's most respected photojournalists, Stoddart works closely with Getty Images to produce features on serious world issues.He said,
"The world's nations will soon be joined together in a wonderful sporting festival whose motto is 'swifter, higher, stronger'. I hope that people visiting the exhibition will leave with a greater determination to understand and help those with little access to clean water, food and medicines who, through no fault of their own, cannot run more swiftly, jump higher or be stronger".
Tom Stoddart
Tom Stoddart began his photographic career with a provincial newspaper in his native North East of England.
In 1978 he moved to London and, working freelance, started to regularly supply national newspapers and magazines. In the eighties he worked extensively for the Sunday Times newspaper.
Stoddart was in Beirut in 1982 when the Israeli forces bombed Yasser Arafat's besieged PLO base and again in 1987 shooting a world exclusive on the horrific conditions inside the
Palestinian camp of Bourj el Barajneh, where Dr. Pauline Cutting was trapped.
Later he spent time aboard the Greenpeace ship 'Rainbow Warrior' where he shot a widely published story about the environmentalists' efforts to stop the Canadian cull of baby seals in the Gulf of St Lawrence.
Stoddart has witnessed many international events including the Romanian Revolution and the massing of alliance troops in the Middle East for the Desert Storm conflict with Iraq. He has subsequently spent time with British Royal Marines on more recent operations in Iraq.
In July 1991, he travelled to Sarajevo to document the civil war that was engulfing Yugoslavia.
His work from there was published around the world. Returning a year later for The Sunday Times Magazine, he was seriously injured in heavy fighting around the Bosnian Parliament buildings.
After a year of recovery, Stoddart threw himself back into photojournalism, producing a powerful feature on the aftermath of the Mississippi floods and, later that year, an award-winning photo-essay on the harsh regime for the training of Chinese Olympic Child Gymnasts.
In December 1993 he returned to Sarajevo to report on the hardship of life in the city during a freezing winter under siege. This trip confirmed his fascination with a place that he was to return to on a dozen different occasions up until the Dayton Peace Accord in 1995. Earlier this year he revisited the city, on the 20th Anniversary of the lifting of the siege.
In 1997 Tony Blair gave Tom Stoddart exclusive access for three months to document his election campaign as Labour swept to victory after 18 years of Conservative government. He was later give access to Prime Ministers Gordon Brown and David Cameron.
Now established as one of the world's most respected photojournalists, Tom Stoddart is represented by, and works closely with Getty Images, to produce campaigning photographic projects on the serious world issues of our time.
http://www.TomStoddart.com
Photo-journalism	Berlin Wall, BJP, Getty Images, Iraq, London, oxfordschoolofphotography.co.uk, Paralympic Games, Perspectives, Photograph, Photographer, photographersworkshop.co.uk, South Bank, Stoddart, Tom Stoddart, Yasser Arafat
Joe Raedle: Featured photojournalist
Leave a comment Posted by oxfordschoolofphotography on May 29, 2012
Showcasing some of the world's best photojournalists.
"The Guardian receives many thousands of pictures every day, some days more than 20,000. Of these, many are publicity hand-outs, soft paparazzi images and material for the sports pages.
However, among all these photographs there are some real gems. The agencies that the Guardian subscribes to – AP, Reuters and Getty Images, among others – have some truly great photojournalists on their staff and under contract, although they probably would be too modest to describe themselves as such. We would like to recognise some of these unsung heroes by presenting their work in galleries, rather than publish them in the usual, one-off, spot news format."….MORE
Joe Raedle
"Joe Raedle was a student at the Maine Photographic Workshop in Rockport. He was hired as a staff photographer at Fort Lauderdale's Sun-Sentinel in 1987 and his 11-year tenure there took him across the globe. He joined Getty Images in 2000 and is now based in Washington, DC. Here, he returns to Joplin, Missouri, to cover the city's regeneration on the first anniversary of a devastating tornado"
See more from this gallery here
Photo-journalism	Associated Press, Getty Images, Guardian, Joe Raedle, Joplin, Joplin Missouri, oxfordschoolofphotography.co.uk, Photograph, Photographer, photographersworkshop.co.uk, Photography, Photojournalism, Reuters, The Guardian, Washington DC
Photos: The Conflict in Sudan
Leave a comment Posted by oxfordschoolofphotography on April 27, 2012
From the excellent Denver Post pblogs
"Sudan's president has threatened to topple the government of South Sudan during a visit to an oil-rich border town that has sparked a recent surge in violence between the two countries.
Omar al-Bashir's comments Monday were the latest in a war of words against Sudan's southern neighbors.
The two countries disagree over where the border between them lies and ownership of oil resources in the region.
This latest outbreak of violence threatens to escalate into a full-scale war.
Al-Bashir vowed during his visit to Heglig to press ahead with his military campaign until, according to him, all southern troops or affiliated forces are chased out of the north.
His forces bombed a major town inside South Sudan Monday. (AP)"
Sudanese jet planes bombed near the bridge in Bentiu, South Sudan, on April 14, 2012. The attack killed at least four civilians. (Alan Boswell/MCT)
A Sudanese soldier rides a bicycle during a patrol following clashes between the army and South Sudan's forces in the town of Talodi in South Kordofan, about 50 kms (30 miles) from the disputed frontier with South Sudan, on April 12, 2012. The leaders of Sudan and South Sudan accused each other of wanting war, with each denying the other's charge, as Sudanese war planes bombed a bridge in the South after days of fighting in a contested border region. (ASHRAF SHAZLY/AFP/Getty Images)
This photo of Sunday, April 15, 2012, shows a soldier from the Darfuri rebel group Justice and Equality Movement at a South Sudanese position in Heglig, South Sudan. Sudan has accused South Sudan of fighting alongside the rebel group in the recent clashes along the disputed border. Two Sudanese Sukhoi fighters dropped 6 bombs in the Bentiu area, killing five and wounding four others. (AP Photo/Michael Onyiego)
A picture taken on April 14, 2012 shows Peter Yien Chuol, a local farmer, waiting for treatment at the Bentiu Hospital after being injured by a bomb in Bentiu. A Sudanese plane bombed Bentiu, capital of South Sudan's oil-rich border state of Unity, on April 14, killing five civilians and wounding six, a local government spokesman said. Gideon Gatfan, spokesman of the Unity state government, said one bomb fell beside a car market near a bridge which was the target of the raid. (ADRIANE OHANESIAN/AFP/Getty Images)
See the rest of these moving pictures here
Photo-journalism, Photography	ADRIANE OHANESIAN, AFP, Bentiu, Denver Post, Getty Images, Heglig, Omar al-Bashir, oxfordschoolofphotography.co.uk, Photograph, Photographer, Photographers, Photographers Workshop, photographersworkshop.co.uk, Photography, South Kordofan, South Sudan, Sudan, Unity
Webfeed From the agencies – galleries of photo-journalism
Leave a comment Posted by oxfordschoolofphotography on November 5, 2011
If you are enjoying these images from the various sources of photo-journalism you would like the series in the Guardian called 'From the Agencies' here is a link to the page that has a number of galleries from around the world.
However, among all these photographs there are some real gems. The agencies that the Guardian subscribes to – AP, Reuters and Getty Images, among others – have some truly great photojournalists on their staff and under contract, although they probably would be too modest to describe themselves as such. We would like to recognise some of these unsung heroes by presenting their work in galleries, rather than publish them in the usual, one-off, spot news format"
Here are some from the featured photographers
Engi, five, Ziona's youngest, poses with other children from the family Photograph: Adnan Abidi/Reuters
Locals mingle at a market in Thimphu, Bhutan, on the eve of the royal wedding between King Jigme Khesar Namgyel Wangchuck and Jetsun Pema Photograph: Paula Bronstein/Getty Images
National Transitional Council (NTC) fighters on the runway of the airport in Sirte, Libya. The city is of vital strategic importance and has now been surrendered by pro-Gaddafi forces, says the NTC Photograph: Manu Brabo/AP
Photo-journalism	Getty Images, Guardian, Libya, Muammar al-Gaddafi, NTC, oxfordschoolofphotography.co.uk, photo-journalism, Photograph, Photographer, photographersworkshop.co.uk, Photography, Photojournalism, Reuters, Thimphu
Cesc Fabregas career in pictures
Leave a comment Posted by oxfordschoolofphotography on August 15, 2011
Yawn……if you must here are more
Photo-journalism, Photography	Arsennal, Barcelona, Cesc Fabregas, Getty Images, Photography, will he won't he
Featured photojournalist: Mario Tama
Mario Tama joined Getty Images in 2001 and is based in New York. Here, he covers Mississippi river floods, courtesy of the Guardian
Photograph: Mario Tama/Getty Images
Photography	Getty Images, Mario Tama, oxfordschoolofphotography.co.uk, photographersworkshop.co.uk, The Guardian
Patrick Baz Is in His Element in Libya
You must have seen the iconic image of the fighter jet spear to earth on the front of the newspapers at the weekend, here is an interview with the photographer Patrick Baz. Patrick Baz, 47, is the Middle East photo manager for Agence France-Presse, based in Cyprus. He has been covering the conflict in Libya since the end of February. His telephone conversation with Kerri MacDonald and David Furst on Monday night has been edited and condensed….more here
Uncategorized	Agence France-Presse, Benghazi, Getty Images, Libya, Middle East, Patrick Baz


A one-day orientation workshop was conducted in Nepalgunj on 31 May 2015 for the potential applicants from Mid/Far West Regions of Nepal. The purpose of the orientation workshop was to provide information on the Adaptation at Scale Prize Stage One Application Process, including Eligibility Criteria, Judging Criteria, and Terms & Conditions etc. and to generate maximum participation of applicants from the both regions. The workshop was conducted by Adaptation at Scale Prize, Ideas to Impact and organized in coordination with Mid and Far West regions based respective regional secretariats of NGONCC, YAC Nepal, Dhangadi and DWO, Banke.
A total number of 40 participants representing NGOs, CBOs, Government agency representatives, community users' group members etc. attended the workshop. The workshop started with a session on Adaptation at Scale Prize – Background, Context and Implications to Adaptation and was conducted further with sessions that oriented the participants on Eligibility Criteria and Judging Criteria of applying process of the Adaptation at Scale Prize. The other sessions conducted was on Frequently Asked Questions and Guidelines on the Prize Applying process. A session on how to register online on the web platform of the Adaptation at Scale Prize website was also demonstrated for the participants.
During the 2nd half of the workshop a group work was conducted among the participants. There were 4 groups who were given situations (cases) and each group had to present their findings in each case from the perspective of eligibility criteria and judging criteria of the prize scheme as discussed with them earlier. They were to analyse the strength and weakness of each case and give their opinion whether the case is fit to the prize scheme or not?


text:
Tucker Carlson Got Some News That Is Driving Democrats Truly Insane
"Tucker Carlson" by Gage Skidmore is licensed under CC BY-SA 2.0
Tucker Carlson has become the bane of the left's existence.
The Fox News host has been a thorn in their side ever since sliding into his primetime slot.
Now Carlson got some news that is driving Democrats completely insane.
According to the latest ratings from Nielsen Media Research, Carlson's show had its highest-rated month ever.
Carlson averaged over 3.4 million viewers for the month, and 551,000 in the critical 25-54 demographic.
Fox News was the top-rated cable news channel for the 41st consecutive month, and saw a 15% increase in viewership.
Conversely, CNN saw an 11% drop in primetime viewership.
Carlson's and Fox News's spike in the ratings combined with CNN's sharp drop suggests that the impeachment charade was a flop in the eyes of most Americans.
But what has to be truly infuriating for the Democrats is that their nonstop campaign to have Carlson taken off the air has failed miserably.
Prominent leftists have worked in conjunction with Media Matters, a left-wing smear machine, to go after Carlson's advertisers.
It's a despicable tactic that the left has employed for years.
They can't stand that Carlson is popular, so they want to take him off the air despite the fact that many people watch his show.
The only primetime host more popular than Carlson is Fox News' Sean Hannity with a narrow lead in the ratings.
Carlson presents a unique challenge to the left.
He opposes unfettered illegal immigration and does it by exposing the hypocrisy and nonsense of the left.
Illegal immigration is currently the most powerful weapon the Democrats have at the moment, so Carlson is a particular threat.
Without endless waves of illegal immigration, Democrats would struggle mightily in national elections.
Instead they've turned California—a state that sent two Republican governors to the White House—into a Democratic stronghold.
Illegal immigration has also helped flip Virginia blue, and Texas is on the brink of turning purple.
Carlson has also pointed out how illegal immigration has put downward pressure on U.S. blue collar wages, a point Democrats used to make when they were more hawkish on immigration.
But they've long since sold out the American worker in order to get new voters.
Carlson is also staunchly anti-war, which rankles the war hawks in the Democratic Party as well as the Trump Derangement Syndrome contingent that reflexively supports war because Donald Trump opposes it.
These are the same people that said Trump would start a nuclear war during the 2016 election.
Carlson advised Trump not to carry out a military strike against Iran that would've killed 150 people.
Democrats in big media actually called Trump a "coward" for not authorizing the strike.
Carlson is also willing to engage with the left on his show, often giving people a chance to see how bankrupt their ideas are.
For these reasons, Democrats perpetually have Carlson in their sights.
But despite their deceitful campaign, Carlson is going strong in the ratings.
Tags big media Democrats Fox News Liberal Bias Tucker Carlson
Photo by Senate Democrats on Flickr
Tucker Carlson Shut Down COVID Tyrants With One Sentence
Photo on JumpStory
Democrats Told One Lie About The Election That's Coming Back To Haunt Them
Photo by RosieTulips on Flickr.com
Fox News Did Something On Election Night That Made Republicans Furious


text:
Functional solution about stochastic differential equation driven by $G$-Brownian motion
January 2015, 20(1): 295-321. doi: 10.3934/dcdsb.2015.20.295
The stability of a perturbed eco-epidemiological model with Holling type II functional response by white noise
Qiumei Zhang 1, , Daqing Jiang 1, and Li Zu 1,
School of Mathematics and Statistics, Northeast Normal University, Changchun 130024, China, China
Received August 2013 Revised July 2014 Published October 2014
In this paper, we have proposed and analyzed a perturbed eco-epidemiological model with Holling type II functional response by white noise. By Lyapunov analysis methods, we prove the stochastic stability, its long time behavior around the equilibrium of deterministic eco-epidemiological model and the stochastic asymptotic stability. Numerical simulations for a hypothetical set of parameter values are presented to illustrate the analytical findings.
Keywords: stochastically asymptotically stable., Holling type II functional response, extinction, Eco-epidemiological model, asymptotically stable.
Mathematics Subject Classification: Primary: 92B05, 93E15, 60H10; Secondary: 34E1.
Citation: Qiumei Zhang, Daqing Jiang, Li Zu. The stability of a perturbed eco-epidemiological model with Holling type II functional response by white noise. Discrete & Continuous Dynamical Systems - B, 2015, 20 (1) : 295-321. doi: 10.3934/dcdsb.2015.20.295
E. Berettaa, V. Kolmanovskiib and L. Shaikhetc, Stability of epidemic model with time delays influenced by stochastic perturbations,, Math Comput Simulat, 45 (1998), 269. doi: 10.1016/S0378-4754(97)00106-7. Google Scholar
J. Chattopadhyay and O. Arino, A predator-prey model with disease in the prey,, Nonlinear Anal., 36 (1999), 747. doi: 10.1016/S0362-546X(98)00126-6. Google Scholar
J. Chattopadhyay and N. Bairagi, Pelicans at risk in Salton Sea - an eco-epidemiological study,, Ecol. Model., 136 (2001), 103. Google Scholar
J. Chattopadhyay, P. D. N. Srinivasu and N. Bairagi, Pelicans at risk in Salton Sea - an eco-epidemiological model II,, Ecol. Model., 167 (2003), 199. doi: 10.1016/S0304-3800(03)00187-X. Google Scholar
J. Chattopadhyay, P. K. Roy and N. Bairagi, Role of infection on the stability of a predator-prey system with several response functions - A comparative study,, Journal of Theoretical Biology., 248 (2007), 10. doi: 10.1016/j.jtbi.2007.05.005. Google Scholar
D. J. Higham, An algorithmic introduction to numerical simulation of stochastic differential equations,, SIAM Rev., 43 (2001), 525. doi: 10.1137/S0036144500378302. Google Scholar
H. W. Hethcote, W. Wang, L. Han and Z. Ma, A predator-prey model with infected prey,, Theor. Popul. Biol., 66 (2004), 259. doi: 10.1016/j.tpb.2004.06.010. Google Scholar
K. P. Hadeler and H. I. Freedman, Predator-prey population with parasite infection,, J. Math. Biol., 27 (1989), 609. doi: 10.1007/BF00276947. Google Scholar
C. Y. Ji, D. Q. Jiang and N. Z. Shi, Multigroup SIR epidemic model with stochastic perturbation,, Physica A, 390 (2011), 1747. doi: 10.1016/j.automatica.2011.09.044. Google Scholar
C. Y. Ji, D. Q. Jiang, Q. S. Yang and N. Z. Shi, Dynamics of a multigroup SIR epidemic model with stochastic perturbation,, Automatica, 48 (2012), 121. doi: 10.1016/j.automatica.2011.09.044. Google Scholar
C. Y. Ji and D. Q. Jiang, Stochastically asymptotically stability of the multi-group SEIR and SIR models with random perturbation,, Commun Nonlinear Sci Numer Simulat., 17 (2012), 2501. doi: 10.1016/j.cnsns.2011.07.025. Google Scholar
C. Y. Ji and D. Q. Jiang, Analysis of a predator-prey model with disease in the prey,, Int. J. Biomath., 6 (2013). doi: 10.1142/S1793524513500125. Google Scholar
X. Y. Li and X. R. Mao, Population dynamical behavior of non-autonomous Lotka-Volterra competitive system with random perturbation,, Discrete and Continuous Dynamical Systems A, 24 (2009), 523. doi: 10.3934/dcds.2009.24.523. Google Scholar
X. R. Mao, Stochastic Differential Equations and Applications,, Horwood, (1997). doi: 10.1533/9780857099402. Google Scholar
E. Venturino, Epidemics in predator-prey models: Disease in the prey,, in Mathematical Population Dynamics: Analysis of Heterogeneity (eds. O. Arino, (1995), 381. Google Scholar
E. Venturino, Epidemics in predator-prey models: Disease in the predators,, IMA J. Math. Appl. Med. Biol., 19 (2002), 185. doi: 10.1093/imammb19.3.185. Google Scholar
Y. Xiao and L. Chen, Modelling and analysis of a predator-prey model with disease in the prey,, Math. Biosci., 171 (2001), 59. doi: 10.1016/S0025-5564(01)00049-9. Google Scholar
Shuping Li, Weinian Zhang. Bifurcations of a discrete prey-predator model with Holling type II functional response. Discrete & Continuous Dynamical Systems - B, 2010, 14 (1) : 159-176. doi: 10.3934/dcdsb.2010.14.159
Jing Li, Zhen Jin, Gui-Quan Sun, Li-Peng Song. Pattern dynamics of a delayed eco-epidemiological model with disease in the predator. Discrete & Continuous Dynamical Systems - S, 2017, 10 (5) : 1025-1042. doi: 10.3934/dcdss.2017054
M. W. Hirsch, Hal L. Smith. Asymptotically stable equilibria for monotone semiflows. Discrete & Continuous Dynamical Systems - A, 2006, 14 (3) : 385-398. doi: 10.3934/dcds.2006.14.385
Jun Zhou, Chan-Gyun Kim, Junping Shi. Positive steady state solutions of a diffusive Leslie-Gower predator-prey model with Holling type II functional response and cross-diffusion. Discrete & Continuous Dynamical Systems - A, 2014, 34 (9) : 3875-3899. doi: 10.3934/dcds.2014.34.3875
Zengji Du, Xiao Chen, Zhaosheng Feng. Multiple positive periodic solutions to a predator-prey model with Leslie-Gower Holling-type II functional response and harvesting terms. Discrete & Continuous Dynamical Systems - S, 2014, 7 (6) : 1203-1214. doi: 10.3934/dcdss.2014.7.1203
Scipio Cuccagna. Orbitally but not asymptotically stable ground states for the discrete NLS. Discrete & Continuous Dynamical Systems - A, 2010, 26 (1) : 105-134. doi: 10.3934/dcds.2010.26.105
Jian Zu, Wendi Wang, Bo Zu. Evolutionary dynamics of prey-predator systems with Holling type II functional response. Mathematical Biosciences & Engineering, 2007, 4 (2) : 221-237. doi: 10.3934/mbe.2007.4.221
Shanshan Chen, Junping Shi, Junjie Wei. The effect of delay on a diffusive predator-prey system with Holling Type-II predator functional response. Communications on Pure & Applied Analysis, 2013, 12 (1) : 481-501. doi: 10.3934/cpaa.2013.12.481
Wonlyul Ko, Inkyung Ahn. Pattern formation of a diffusive eco-epidemiological model with predator-prey interaction. Communications on Pure & Applied Analysis, 2018, 17 (2) : 375-389. doi: 10.3934/cpaa.2018021
Kazuhiro Oeda. Positive steady states for a prey-predator cross-diffusion system with a protection zone and Holling type II functional response. Conference Publications, 2013, 2013 (special) : 597-603. doi: 10.3934/proc.2013.2013.597
François Genoud. Orbitally stable standing waves for the asymptotically linear one-dimensional NLS. Evolution Equations & Control Theory, 2013, 2 (1) : 81-100. doi: 10.3934/eect.2013.2.81
Guohong Zhang, Xiaoli Wang. Extinction and coexistence of species for a diffusive intraguild predation model with B-D functional response. Discrete & Continuous Dynamical Systems - B, 2018, 23 (9) : 3755-3786. doi: 10.3934/dcdsb.2018076
Tzung-shin Yeh. S-shaped and broken s-shaped bifurcation curves for a multiparameter diffusive logistic problem with holling type-Ⅲ functional response. Communications on Pure & Applied Analysis, 2017, 16 (2) : 645-670. doi: 10.3934/cpaa.2017032
Kexin Wang. Influence of feedback controls on the global stability of a stochastic predator-prey model with Holling type Ⅱ response and infinite delays. Discrete & Continuous Dynamical Systems - B, 2017, 22 (11) : 0-0. doi: 10.3934/dcdsb.2019247
Zhifu Xie. Turing instability in a coupled predator-prey model with different Holling type functional responses. Discrete & Continuous Dynamical Systems - S, 2011, 4 (6) : 1621-1628. doi: 10.3934/dcdss.2011.4.1621
Ewa Schmeidel, Karol Gajda, Tomasz Gronek. On the existence of weighted asymptotically constant solutions of Volterra difference equations of nonconvolution type. Discrete & Continuous Dynamical Systems - B, 2014, 19 (8) : 2681-2690. doi: 10.3934/dcdsb.2014.19.2681
Sze-Bi Hsu, Tzy-Wei Hwang, Yang Kuang. Global dynamics of a Predator-Prey model with Hassell-Varley Type functional response. Discrete & Continuous Dynamical Systems - B, 2008, 10 (4) : 857-871. doi: 10.3934/dcdsb.2008.10.857
Zhijun Liu, Weidong Wang. Persistence and periodic solutions of a nonautonomous predator-prey diffusion with Holling III functional response and continuous delay. Discrete & Continuous Dynamical Systems - B, 2004, 4 (3) : 653-662. doi: 10.3934/dcdsb.2004.4.653
Juraj Földes, Peter Poláčik. On asymptotically symmetric parabolic equations. Networks & Heterogeneous Media, 2012, 7 (4) : 673-689. doi: 10.3934/nhm.2012.7.673
Andrew M. Zimmer. Compact asymptotically harmonic manifolds. Journal of Modern Dynamics, 2012, 6 (3) : 377-403. doi: 10.3934/jmd.2012.6.377
Qiumei Zhang Daqing Jiang Li Zu


text:
Q: A pattern to call sequence of ajax calls? I've a method with 4 subsequent ajax calls, which look like:
$.ajax({
    success: function( response ){
        $.ajax({
            success: function( response ) {
               ..more calls deeper..
            },
            error: function( ) {
                showError();
            }
        });
    },
    error: function( ) {
        showError();
    }
});

Is there any pattern to chain all thouse calls without nesting and duplicating error callback?

A: Something like this:
$.when(
  // first one
  //data = data1
  $.get("your-url-1-here"),

  // second one
  // data = data2
  $.get("your-url-2-here"),

  // third one
  //data = data3
  $.get("your-url-3-here"),

  // fourth one
  // data = data4
  $.get("your-url-4-here")

).then(function( data1, data2, data3, data4 ) {

  //Do something with data1, data2, data3 and data4

});

A: Regarding the duplication of the error callback, just point to the showError function like this:
error: showError

No need to wrap it in a function there

A: var flagIsFinished = false;
function ajax(successCB, errorCB){
  if(!flagIsFinished){
    $.ajax({
      'success':function(){
        ajax(successCB, errorCB);
      }
      'error':errorCB
    });
  }
}

Work with a flag. Set it true in the successCB when you're finished. Like this you'll never have to worry how many times you have to run the ajax function, just make sure you test the end condition very well. Otherwise you could get an endless loop with this approach.


text:
Mishaal's call for smart politics
Published by at 8:36 pm under Articles,Palestinian politics
      Â
While addressing mourners for the loss of his mother in Jordan, Hamas leader Khaled Mishaal highly praised Jordan and Jordanian officials, and then spoke of a four-step approach to change the balance of power that is currently crushing Palestinians.
Mishaal, who along with Jordanian leaders of Hamas was deported from the Kingdom in 1999, has been allowed to visit for humanitarian family circumstance, such as the death of his father seven years ago and this week the passing of his mother.
At the conclusion of the three-day wake, the Hamas leader said he was speaking as a "free Arab and an open-minded Muslim".
He called on fellow Palestinians and supporters to make use of all the points of strength they have, spoke forcefully about the need for national unity and reconciliation, and highlighted the need for a national Palestinian strategy.
Mishaal said that such a strategy should not contradict principles, but neither should it handcuff politically those pursuing it, saying that politicians should be clever and shrewd in executing such a national strategy.
But the most interesting point of Mishaal's speech in Amman came in his concluding point, in his fourth step approach.
"We need to execute a policy that is based on smart politics that uses opportunities not squanders them," he said in a 20-minute speech that was carried live on Al Jazeera.
It was very refreshing to hear the leader of The Islamic Resistance Movement, Hamas, speak with such cleverness and intelligence. Too bad he decided not to compete for re-election as the head of the Hamas politburo, which will take place before the end of this year.
But then leaders are often the most honest when they are on their way out and no longer trying to speak merely for political consumption.
What would be a smart and yet shrewd Palestinian policy that uses opportunities and does not squander them?
At the level of Palestinian presidency, it is clear that a smart policy does not reject ideas, but at the same time refuses to be part of a photo opportunity to show the world that everything is ok.
This in many ways seems to be what Mahmoud Abbas is doing, as entangled in internal politics as he is, especially regarding the former Fateh leader Mohammad Dahlan.
In recent years, Abbas and the PLO have been unable to improve the balance of forces that weighs so much against Palestinians and their aspirations.
An important question to Mishaal and his Hamas movement: Â What are some of the smart policies that can be adopted today to improve the status of Palestinians in Gaza, first, and throughout Palestine?
When pro-Hamas candidates won the 2007 parliamentary elections, they were faced with a dilemma. They could not suddenly recognise Israel and abandon their own charter, but they were pressed by the world community to make some changes so as to be allowed to gain international legitimacy and be able govern properly.
Hamas could have endorsed a governmental policy statement that included the conditions of the international community without contradicting its own principles.
It also could simply have said what every government in the world says once it takes over power, i.e., that it will honour all previous government commitments.Â
This would have satisfied the world without having to spell out specific commitments that run against Hamas' principles.Â
It did not, and we have since seen the deepest and most troublesome division in recent history.
Just this week, Hamas interior ministry operatives arrested, harassed and tortured a journalist colleague, Mohammad Othman, in Gaza.
Othman, an investigative journalist, has been researching the status of hospitals and medical care in Gaza, where many questionable administrative and financial decisions are made.Â
He was released a day later and has publicly exposed the way he was treated in a Hamas-controlled detention centre.
Hamas' decision to run for the current municipal elections could be chalked up as a smart political decision.
It probably was forced on it when it realised that the West Bank would have the regular municipal elections every four years anyway.Â
Hamas, along with its allies in the Arab world, has been on the defensive ever since president Mohamed Morsi was deposed and Abdel Fattah Al Sisi took over power in Egypt.
Of course, Hamas and Fateh can take the smartest political decision by immediately implementing the reconciliation agreement so that Palestinians can move quickly to presidential and parliamentary elections and end this sad chapter of division that has weakened the Palestinian cause and effort to gain freedom and independence.
Mishaal is right when he says that the balance of forces is crushing Palestinians and there is need for unity, strategy and smart politics.
The sooner leaders start using their heads and not their emotions, the sooner Palestinians will begin the hard process of tipping the balance of forces in their favour.
The world is ready for change in favour of the Palestinians. But it is hard to expect the world to change before Palestinians are united behind a doable strategy and use all the smart and shrewd tactics needed to achieve liberation.


text:
Q: How to check if the sequence of ints has even and odd numbers alternating using LINQ, C# Let's say I have a list of ints in c# like this:
List<int> numbers = new List<int>() { 1, 2, 7, 20, 3 };

Is there a way of checking that it has alternating odd and even numbers in it (like in the example above: if one if them is even then the next must be odd or vice versa)?
I know it's simple to check it in a loop, but I'm trying to implement this using LINQ and extension methods only.

A: Let's analyze the problem. What does it mean alternating parity?
  index : value : value + index
  ------------------------------
      0 :     1 : 1 - note, all sums are odd
      1 :     2 : 3
      2 :     7 : 9
         ....

Or
  index : value : value + index
  ------------------------------
      0 :     2 : 2 - note, all sums are even
      1 :     1 : 2
      2 :     6 : 8
         ....

As you can see (and you can easily prove it) alternating parity means that
index + value sums are either all odd or all even. Let's check it with a help of Linq:
  List<int> numbers = new List<int>() { 1, 2, 7, 20, 3, 79 };

  bool result = numbers
    .DefaultIfEmpty()
    .Select((item, index) => Math.Abs((long)item + (long)index))
    .Aggregate((s, a) => s % 2 == a % 2 ? s % 2 : -1) >= 0;

Notes to the implementation:

*

*DefaultIfEmpty() - empty sequence has all (all zero) values alternating; however, Aggregate has nothing to aggregate and throws exception. Let's turn empty sequence into one element sequence.

*(long) in order to prevent integer overflow (int.MaxValue + index can well be out of int range)

*Math.Abs: c# can return negative remainder (e.g. -1 % 2); we don't want an additional check for this, so let's work with absolute values

*However, we can exploit this effect (-1 % 2 == -1) in the final Aggregate
Extension Method solution I hope is easier to understand:
  public static bool IsAlternating(this IEnumerable<int> source) {
    if (null == source)
      throw new ArgumentNullException(nameof(source));

    bool expectedZero = false;
    bool first = true;

    foreach (int item in source) {
      int actual = item % 2;

      if (first) {
        first = false;
        expectedZero = actual == 0;
      }
      else if (actual == 0 && !expectedZero || actual != 0 && expectedZero)
        return false;

      expectedZero = !expectedZero;
    }

    return true;
  }

Note, that the loop solution (extension method) is more efficient: it returns false immediately when pattern doesn't meet.

A: You can do with LINQ in this way. you can check if there is atelast one even item at add place or an odd item at even place.
List<int> numbers = new List<int>() { 1, 2, 7, 20, 3 };
var temp = numbers.Where((x, i) => (i % 2 == 0 && x % 2 == 0) || (i % 2 == 1 && x % 2 == 1)).Take(1);
int count = temp.Count();
if(count == 0)
{
    //true
}
else
{
    //false
}

Note: Assuming that you are expecting even numbers at even place and odd numbers at an odd place.

A: You can use Aggregate to determine if a sequence is alternating.
Let's assume that if there's 0 or 1 elements then the result is true.
You can modify this logic however you see fit.
Based on this an extension method can be created:
    public static bool IsAlternatingParitySequenceVerbose(this IEnumerable<int> col)
    {
        // state:
        // -1 - sequence is not alternating
        //  0 - even
        //  1 - odd

        if (!col.Any())
            return true;

        //check if first value is even
        var firstState = Math.Abs(col.First() % 2);

        var IsAlternating = col.Skip(1).Aggregate(firstState, (state, val) =>
        {
            if (state == -1)
                return -1;

            var current = Math.Abs(val % 2);
            if (current == state)
                return -1;

            return current;
        });

        return IsAlternating != -1;
    }

And then make a one-liner out of it:
    public static bool IsAlternatingParitySequence(this IEnumerable<int> col) =>
        !col.Any()
        || col.Skip(1).Aggregate(Math.Abs(col.First() % 2), (state, val) =>
                state == -1
                    ? -1
                    : Math.Abs(val % 2) is var current && current == state
                    ? -1
                    : current
            ) != -1;


New Delhi, (IANS) A day after Delhi's Lt Governor Najeeb Jung resigned, Chief Minister Arvind Kejriwal on Friday morning met him at his residence here.
The Aam Aadmi Party (AAP) national convenor, who was locked in a running battle with Jung for a long time, told reporters that the two met over breakfast.
The meeting between the AAP leader and Jung lasted for about an hour.
Jung became the Lt Governor on July 9, 2013 when the Congress-led UPA was in power. The Narendra Modi government retained him even as it replaced most governors in the states.
Jung is a former IAS officer from the Madhya Pradesh cadre. He is also a former Vice Chancellor of Jamia Millia Islamia in New Delhi. He said he would return to his "first love" academics.


We are unable to predict the future value of digital currency, however, there are good indicators in determining the outcome of it's future value which are as such; the technology advancement, the different applications of the currency, partnerships with the market-based economy and regulations put in place by the central authority. A common understanding to all kinds of investment pursuits is that one should do research before committing and one should never commit because of a price prediction that is seemingly optimistic.
Will one unit of Bitcoin ever cross US$20,000 in 2020? Many have pondered about this and hence stuck in a conundrum on whether they should invest in this relatively new type of currency. A recent comment by two analysts from established banks, during their course of Bitcoin analysis, predicts that one unit of Bitcoin will be able to cross US$90,000 in the next five years. They based this forecast on the fact that majority of the crypto-assets market capitalisation is held in the traditional store of value markets, and with offshore deposits amounting to nearly 40% of the total value. Hence, growth in this market capitalization will come primarily from the increased store of value penetration. Moreover, when more custody solutions come on board, this penetration of offshore deposits will increase dramatically. They postulated that the broader digital currency market will enjoy robust growth, reaching a grand total of US$3.6 trillion in 2028, approximately 1,700% higher than the digital currency market's current value of US$200 billion.
Some critics claim that the forecast prices are too ambitious, while others believe that there are difficulties in accurately predicting the value of digital currency will eventually be, five years from now. Bitcoin's worth could rise from US$10,000 to US$100,000 in the next two to three years, as many different variables might come in play to influence the status quo of the market between now and 2020. Digital currencies and assets could be thought of as the future of transactions and a store of value, and Bitcoin is now leading the revolution.
A crucial rallying factor for Bitcoin is in its ability to retain its store of value. Take for instance, places facing hyperinflation like Iran, Turkey, and Venezuela. The use of digital currencies will ensure the purchasing power of the people is to be retained. However, to based an assumption on the fact that such currency will capture a sizeable market share in major economies such as the US, Singapore, Germany and UK over the next five years, is highly plausible.
Market observers have taken notice that Bitcoin could very well hit over $90,000 by 2023. They claimed that a US$100,000 per coin evaluation for Bitcoin is entirely possible, while Bitcoin has a US$112 billion dollar market cap that represents a negligible 0.1% of the entire global money supply of US$90.4 trillion dollars. Hence Bitcoin being a leading digital currency and to be able to cross over US$90,000, given past bull markets, seems achievable. In 2017, Bitcoin's value has increased from below US$1,000 per unit to more than US$16,000 per unit, which is a remarkable sixteen times increment in that year. Today, Bitcoin is trading around $6,450, they reasoned that if Bitcoin were to withstand this volatile level and to continue this up-trending increase, crossing over US$90,000 per unit will be something that will be achievable during the next Bitcoin bull run.
Although Bitcoin has been trading for almost ten years, the regulations placed on the digital currency market is still at its infant stage. Fiat-based investment community claims that when Bitcoin is subjected to regulation, the price of Bitcoin will be unfavourable as there will be many policies to control the inflow and outflow of the coins, hence making it harder for the digital currency to be transfered. However, this was not the case in Japan. In 2017, Japan was the first country in the world to completely regulate Bitcoin the same way as its financial services industry. The government established that Bitcoin and the Japanese yen are to be on par, hence Japan now has the highest trading volume for Bitcoin in the world, with many Japanese using it daily in over 200,000 stores.
If other nations were to adopt the ways of the Japanese government, it will boost Bitcoin's legitimacy. This will beget trust from the global community use digital currency , moreover, this new beginning will call for larger financial institutions to buy and transact in Bitcoin and in turn giving rise to the price of Bitcoin.


Tag Heuer a well renowned brand made many headlines last year for releasing the TAG Heuer Connected smart watch. This year they decided to release a follow up to its widely popular android wear watch and announce its release but ended up releasing the information a day prior to the actual announcement on their site.
The new smartwatch by Tag Heuer is called Connected Modular 45 and much like the name, the device uses a modular design. The Tag Heuer Connected Modular 45 smartwatch was rumored to be released in May and announced on March 14th. The rumors soon proved to be true and Tag Heuer announced they will be announcing a new smartwatch on March 14th. However, Tag Heuer ended up surprising their own surprise as all the information regarding the new smartwatch was released a day before on the site.
As reported by the rumors, the Tag Heuer Connected Modular 45 smartwatch will be powered by the Android Wear 2.0. The Android Wear 2.0 is the most powerful version of Google's operating System for wearable devices. It will also be powered by an Intel CPU and 4GB Ram, have a 45 mm watchface, as well as having features like NFC, GPS, along with being water-resistant to 50 meters. The display will have an AMOLED Screen and ambient light sensors whereas the battery will last longer than 24 hours to ensure optimal use.
A key feature of the Connected Modular 45 smartwatch is its Modular part. According to the details, you can switch the smartwatch module with an analogue module whenever you want. The mechical module with feature a 3-hand mechanical tourbillon as well as having a "Swiss Made" certification, allowing it to challenge the luxury variants of the Apple Watch.
Besides the modular piece, the straps, lugs, and buckles are also interchangeable as well as being available in a variety of different colors. Customers will be able to choose between titanium or PVD for the buckles. On the other hand, customer can choose titanium, titanium with 18K rose gold, titanium with matte black ceramic, and titanium with diamonds for the lugs.
If you'd like to get the new Connected Modular 45 smartwatch for yourself, it will cost $1,650 in the US and 1,600 Euros in Europe. As of now, no on-sale release date has been provided but we will keep you updated as new information is made available.


If you live near the Woodsboro area, turn to LLumar's professional dealers to install high-quality tint. Live stylishly, help lower your energy costs, and drive more comfortably with commercial, residential, and car window tinting. For over 60 years, our professionally-installed window tints have shielded satisfied customers from the sun's intense heat and harmful rays. We help people live comfortably, wherever they work, drive, or play! Your window tint installer has been carefully chosen and certified at the highest level of service to make sure you have an excellent estimate and installation experience! Visit a LLumar dealer near Woodsboro for a window tint estimate today! It's always fast and free!
When it comes to window tint near Woodsboro, visit a company you can trust. Browse a variety of tint shades for your home, car, or commercial window tinting needs at your nearby location. Our car, office, and home window tint is custom cut to fit your space to ensure a flawless installation—every single time! Other window films may change color, peel, or bubble, but not ours! They're made to last! Additionally, have your window film installed by our factory-trained technicians and you could take advantage of the additional protection offered by a lifetime limited warranty. This warranty means that in the off-chance your office, car, or home window tint bubbles, fades, or become discolored, we'll remove and replace it free of charge.
Over time, exposure to heat and sunlight can cause unsightly cracking, peeling, or fading on the interior of your vehicle. LLumar's window tints provide today's drivers with great protection and value for their money. Tint your car windows to better protect the interior, and everyone inside, from the sun's harmful rays, heat, and glare. Select from your tinting company's full assortment of vehicle window tint shades, ranging from translucent to dark charcoal. The laws in your state may legally limit the level of darkness you can select for your car windows. We know your state's regulations. Call or visit today to check out the many options that are available to you!
When you choose custom window tinting for your business, you can help limit your facility's energy expenses while achieving a look that's professional, polished, and unique to your company. Choose from a wide range of tint shades, from clear to deep charcoal. Once installed by your trusted LLumar dealer, non-reflective window tint provides a consistent look that effortlessly complements the architecture of your facility. A dual-reflective option is also available for businesses in need of a shiny exterior to improve solar heat rejection, but a less reflective interior for added privacy at night. When it comes to commercial spaces, window tint isn't just for the exterior of buildings. Inside your facility, it can be installed as an additional design feature that offers style and privacy in stairwells, meeting rooms, and on interior office windows. Ready to cut your business's energy costs and increase your facility's style? Call or visit the experts at a LLumar window tinting location near Woodsboro to get started!
For fast, hassle-free window tint installation, visit your nearest LLumar dealer. Many window custom order window tint projects can be finished within a few days, though it depends on the size of the car, home, or commercial space. Installation takes an average of just 15 minutes per window. For unparallelled window tinting, visit a LLumar tinting company. From home or business window tinting that needs opaque, mirrored, or color-tinted films, your LLumar tinting expert is here to help you select the ideal tint for your needs. Schedule your installation today! Call or visit a LLumar installer near Woodsboro to learn more about your window tint options and to get a free quote. Appointments fill up fast! It's time to improve your view of the world.


Up-to-date coding data, simplified for swift integration!
Rely on a trusted source for timely, accurate data to power your coding, billing and practice management systems with the DecisionHealth Subscription Data File.
Choose from an array of solutions that bring you updated code sets, descriptions, RVUs and Plain English Descriptions for CPT codes as they become available throughout the year.
Data is formatted for seamless integration into your current systems for flexible, easy-to-use essential coding and reimbursement data.
Improve efficiency — keep your systems and software up-to-date.
Increase accuracy — ensure the precision of your coding and billing processes.
Promote compliancy — access the latest information to decrease denials and avoid incorrect payments.
Secure, fast, convenient download via custom URL—no waiting for a disc to ship.
Easy to update — and compliant with all ASCII-compatible billing systems and software.
Available early — so changes can be understood and implemented prior to their effective dates.


Our President and CEO resides in the Town of Westville, New York with his two sons and wife. Read Mike's Bio.
Our Service manager Jason has been part of the Performance Shooting Team since April of 2011. Read Jason's Bio.
Brandon loves the outdoors especially hunting. Read his bio.